I am writing a client to consume a SOAP web service in Android using ksoap2. And I have received a SOAP FAULT exception. Here is an excerpt from the LogCat.
<soapenv:Body><soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soapenv:Client</faultcode><faultstring>Bad request</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>
04-06 09:04:09.693: E/SearchPublications(1159): SoapFault - faultcode: 'soapenv:Client' faultstring: 'Bad request' faultactor: 'null' detail: null
This is how I extracted the values of the final strings from the WSDL:
Namespace
: The value of the attributenamespace
ofxsd:import
element, which is a child element ofxsd:schema
, which is a child element oftypes
SoapAction
: Namespace appended by the method's nameMethodName
: The name of the method in the APIURL
: The actual URL of the WSDL
(Reference: This answer and the link mentioned in it.)
I understand that there is something wrong with my code, but can anyone say what might be causing it and if I have set the values of the mentioned final variables correctly?
I tried by setting the dotnet
flag as true
and false
as well. I am trying to get the response in an SoapObject
as it is an XML document, and I have read in an article that if the result is in XML, use SoapObject
.
I also tried to debug it, and all the variables are apparently having their correct values (as shown in the debug perspective) before this line:
result= (SoapObject) envelope.getResponse();
At this line, a SoapFault excetion is thrown; you can compare the following piece of code and the screenshot. Can somebody suggest why this might be occurring and what else to try to fix it?
try{
result = (SoapObject) soapEnvelope.getResponse();
} catch (Throwable e) {