I use KSOAP to access a webservice for my application. I use a SoapObject to build the request and I got an strange response (in this case strange means not XML).
I'm new with KSOAP and I need to add some changes into an existing project built on KSOAP, so to avoid using it is not an option. The code is simple, and works, but I cannot manage to parse the response.
The code that use for this is:
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("PersonalID", "032676025");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
Log.i("Webservice Output", response.toString());
return response.toString();
} catch (Exception e) {
e.printStackTrace();
}
The issue here is that I cannot find the XML that comes from my webservice as response. I need to get it and to parse it by myself.
The question is: how do I obtain from the objects used in the code above the XML response (as XML)?
Thank you.
I found the solution: set androidHttpTransport.debug = true; before to make the WS call.
After this, you may access the request and the response like this:
String requestDump = androidHttpTransport.requestDump;
String responseDump = androidHttpTransport.responseDump;
Log.i("", "Requeste: " + requestDump);
Log.i("", "Response: " + responseDump);