Web service recieves null parameters from application using ksoap method

bschultz picture bschultz · Jun 15, 2010 · Viewed 7.8k times · Source

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 service it adds it with an additional string then returns it too my application; but all I'm returning is the string message, not the parameter I passed. Is there something wrong with my web service or my soap method?

Soap:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

    request.addProperty("A", "workowr");


    SoapSerializationEnvelope envelope =
        new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);    
        try {
            androidHttpTransport.call(SOAP_ACTION, envelope);
            SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
            //SoapObject result = (SoapObject)envelope.getResponse();       
            String resultData = result.toString();
            testTV.setText(resultData);

        }
        catch(Exception e)
        {
            testTV.setText(e.getMessage());
        }

Here is my simple .Net web service:

Public Function getRegInfo(ByVal A As String) As String

Return A + "String message"

End Function

I would appreciate any help.

Answer

bschultz picture bschultz · Jun 22, 2010

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.