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>
