Search code examples
androidwebservice-clientksoap2

Soap fault while calling webservice using ksoap2 on android


I am consuming a dotnet webservice on android code using ksoap2.I can successfully call the webservice without any parameters but when I tried to call method using a string parameters i am getting this error mentioned below.

soap:Server' faultstring: 'System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.

I am adding the parameters in this way.

request.addProperty("arg0", "username"); 
request.addProperty("arg1", "pass");

Errors thrown in this line

 SoapPrimitive result = (SoapPrimitive)envelope.getResponse();

Solution

  • I solved myself.

    Instead of

    SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
    

    i used

    SoapObject result = (SoapObject) envelope.getResponse();