axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepal Jayasinghe <dee...@opensource.lk>
Subject Re: [Axis2] Request from Axis2 client code to remote svc gives error but request from nonAxis client works
Date Sun, 27 Jan 2008 12:20:26 GMT
Hi Pantvaidya,
I can not see a any difference between the two messages other than XML
deceleration. But I do not think that should be the issue here , is
there any possibility of debugging the coed ?

Thanks
Deepal
>
> Using Axis2 1.3, I have written client code to call a remote
> webservice that does language translation– that call returns with a
> response message “Value cannot be null.
>
> Parameter name: translationmode”. When I call the same service with
> exactly the same data from a UI client or even Axis2 client stub
> (generated using wsdl2java) – it works - none of the messages sent
> have a transationmode param, so why does it complain for my client
> while it does not for the others.
>
>  
>
> I tried comparing the requests sent in each case – but I did not see
> great differences. I have even removed some of those – e.g. I diaabled
> chunking in my client code, but still my client code does not work. I
> am thinking, the problem has got to be in my client code – can anyone
> see anything wrong in it? I am pasting the code and the corresponding
> request-responses here.
>
>  
>
> *_My client code_*
>
>  
>
> String serviceURLStr="http://www.webservicex.net/TranslateService.asmx";
>
> String action="http://www.webservicex.net/Translate";
>
> String serviceNamespace="http://www.webservicex.net/";
>
> String operationName="Translate";
>
> String langModeParamName="LanguageMode";
>
> String textParamName="Text";
>
>            
>
> ServiceClient svcClient;
>
> *try* {
>
>       svcClient = *new* ServiceClient();
>
>       Options opts = *new* Options();
>
>       opts.setTo(*new* EndpointReference(serviceURLStr));
>
>       opts.setAction(action);
>
>      
> opts.setProperty(org.apache.axis2.transport.http.HTTPConstants./CHUNKED/,
> Boolean./FALSE/);
>
>       svcClient.setOptions(opts);
>
>                  
>
>       OMFactory fac = OMAbstractFactory./getOMFactory/();
>
>       OMNamespace ns = fac.createOMNamespace(serviceNamespace, "ns1");
>
>       OMElement payload = fac.createOMElement(operationName, ns);
>
>              
>
>       OMElement langModeElem = fac.createOMElement(langModeParamName, ns);
>
>       langModeElem.setText("EnglishTOFrench");
>
>       payload.addChild(langModeElem);
>
>              
>
>       OMElement textElem = fac.createOMElement(textParamName, ns);
>
>       textElem.setText("Hello 1");
>
>       payload.addChild(textElem);
>
>              
>
>       OMElement responseElem=svcClient.sendReceive(payload);
>
>       OMElement rateElem=responseElem.getFirstElement();
>
>       String convertedText=rateElem.getText();
>
> }…
>
>  
>
> *_The corresponding request that got sent out_*
>
>  
>
> POST /TranslateService.asmx HTTP/1.1
>
> Content-Type: text/xml; charset=UTF-8
>
> SOAPAction: "http://www.webservicex.net/Translate"
>
> User-Agent: Axis2
>
> Host: localhost:8050
>
> Content-Length: 313
>
>  
>
> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:Translate
> xmlns:ns1="http://www.webservicex.net/"><ns1:LanguageMode>EnglishTOFrench</ns1:LanguageMode><ns1:Text>Hello
> 1</ns1:Text></ns1:Translate></soapenv:Body></soapenv:Envelope>
>
>  
>
> *_The response I got_*
>
>  
>
> HTTP/1.1 200 OK
>
> Date: Thu, 24 Jan 2008 00:29:33 GMT
>
> Server: Microsoft-IIS/6.0
>
> X-Powered-By: ASP.NET
>
> X-AspNet-Version: 1.1.4322
>
> Cache-Control: private, max-age=0
>
> Content-Type: text/xml; charset=utf-8
>
> Content-Length: 409
>
>  
>
> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><TranslateResponse
> xmlns="http://www.webservicex.net"><TranslateResult>Value cannot be null.
>
> Parameter name:
> translationmode</TranslateResult></TranslateResponse></soap:Body></soap:Envelope>
>
>  
>
>  
>
> *_Request sent from a UI client like soapUI_*
>
>  
>
> POST /TranslateService.asmx HTTP/1.1
>
> Content-Type: text/xml;charset=UTF-8
>
> SOAPAction: "http://www.webservicex.net/Translate"
>
> User-Agent: Jakarta Commons-HttpClient/3.0.1
>
> Host: localhost:8050
>
> Content-Length: 373
>
>  
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:web="http://www.webservicex.net">
>
>    <soapenv:Header/>
>
>    <soapenv:Body>
>
>       <web:Translate>
>
>          <web:LanguageMode>EnglishTOFrench</web:LanguageMode>
>
>          <!--Optional:-->
>
>          <web:Text>Hello 2</web:Text>
>
>       </web:Translate>
>
>    </soapenv:Body>
>
> </soapenv:Envelope>
>
>  
>
> *_And this is the correct response I got for the soapUI request_*
>
>  
>
> HTTP/1.1 200 OK
>
> Date: Thu, 24 Jan 2008 00:20:29 GMT
>
> Server: Microsoft-IIS/6.0
>
> X-Powered-By: ASP.NET
>
> X-AspNet-Version: 1.1.4322
>
> Cache-Control: private, max-age=0
>
> Content-Type: text/xml; charset=utf-8
>
> Content-Length: 364
>
>  
>
> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><TranslateResponse
> xmlns="http://www.webservicex.net"><TranslateResult>Bonjour
> 2</TranslateResult></TranslateResponse></soap:Body></soap:Envelope>
>

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message