What could be the reason for the Soap Fault (faultcode: soapenv:Client, faultstring:Bad Request)
Asked Answered
B

0

6

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 attribute namespace of xsd:import element, which is a child element of xsd:schema, which is a child element of types
  • SoapAction: Namespace appended by the method's name
  • MethodName: The name of the method in the API
  • URL: 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) {

enter image description here

Biradial answered 6/4, 2014 at 20:22 Comment(1)
seems like you haven't entered correct parameters in your request. you should create a soapObject and add properties you need to send.Elda

© 2022 - 2024 — McMap. All rights reserved.