The one which fails has a "/" at the end of the webservicex namespace which is missing from the one that works. If that's the problem, the cause is in the initial assignment
String serviceNamespace="http://www.webservicex.net/"; Jeff On Jan 27, 2008 4:20 AM, Deepal Jayasinghe <[EMAIL PROTECTED]> wrote: > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
