Skip to content Skip to sidebar Skip to footer

How To Create Proper Soap Envelope (request Xml) In Code While Using Ksoap2?

This is the soap request as obtained from SoapUi by feeding the wsdl.

2) The unrecognized operation exception was due to issue in the MAIN_REQUEST_URL and NAMESPACE. Knowing the proper value of url, namespace and the soap_action is bit tricky, at least for a beginner in this space.

The values of these fields can be set by looking at the request/response xml, wsdl and this nice pictorial example.

In my case, I had to change

MAIN_REQUEST_URL = "http://abc.xyz.com/WSClient/WSServiceSoapHttpPort";NAMESPACE = "http://wsclient.xyz.com//";SOAP_ACTION = "http://wsclient.xyz.com//loginservice";

to

MAIN_REQUEST_URL = "http://abc.xyz.com/WSClient/WSServiceSoapHttpPort?WSDL";NAMESPACE = "http://wsclient.xyz.com/types/";SOAP_ACTION = "http://wsclient.xyz.com//loginservice";

and also I had to change:

Stringmethodname="loginservice";

to

Stringmethodname="loginserviceElement";

as the request/response xml has this ( typ:loginserviceElement ) tag wrapping the properties/parameters.

Post a Comment for "How To Create Proper Soap Envelope (request Xml) In Code While Using Ksoap2?"