Skip to content Skip to sidebar Skip to footer

Web Service Recieves Null Parameters From Application Using Ksoap Method

I've seen topics discussing this but no one has seemed to post a solution. At the moment, I'm testing passing parameters to my .Net web service. When the parameters reach the web s

Solution 1:

What worked for me was changing the namespace URL in both my .Net webservice and in my application.

For example, I had:

"http://www.example.com/webservices/"

i changed to:

"example.com/webservices/"

and it worked perfectly.

Give it a shot.

Solution 2:

Yes - there seems to be some problem with having a colon (:) in the webservice namespace, when connecting via KSoap. Regular non-parameter calls work fine, but parameters seem to go through as null for some reason.

Solution 3:

There is actually no need to have the extra "/" at the end.

After debugging and trying about anything that is written on the net, i found out that the most important thing when passing parameters is to have the same statement in your WebService-declaration and ksoap2.

So use "/" on both places or remove it from both places. the "http://" is also okey to use.

Solution 4:

The perfect code that adds the parameters this works try this

       SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, OPERATION_NAME);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    envelope.dotNet = true;
    PropertyInfo pi = new PropertyInfo();
    pi.setName("ProcName");
    pi.setValue(a);
    pi.setType(int.class);
    request.addProperty(pi);
    pi=new PropertyInfo();
    pi.setName("UserName");
    pi.setValue(b);
    pi.setType(String.class);
    request.addProperty(pi);

    pi=new PropertyInfo();
    pi.setName("Password");
    pi.setValue(c);
    pi.setType(String.class);
    request.addProperty(pi);

    pi=new PropertyInfo();
    pi.setName("Paras");
    pi.setValue(d);
    pi.setType(String.class);
    request.addProperty(pi);


    Object response = null;

    HttpTransportSE androidHttpTransport = new HttpTransportSE(SOAP_ADDRESS);

    try {
        androidHttpTransport.call(SOAP_ACTION, envelope);
        response = envelope.getResponse();
    } catch (finalException e) {
        Stringerror = "no";
    }
    return response.toString();
}

Solution 5:

You have to copy and past Name Space and soap action exactly the same they appear in WSDL xml file .

I had the same problem and when I removed http:// from (Name Space and Soap Action) the problem was solved.(in the WSDL they are without http://) Actually I tried to access local web service (the service installed in local server )

However I have another application that access an external .NET web service ( central bank web service to get rate exchange ) The WSDL NameSpace and SoapAction Contains http:// My application worked perfectly without removing http://

Post a Comment for "Web Service Recieves Null Parameters From Application Using Ksoap Method"