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.
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.
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.
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.
The perfect code that adds the parameters this works try this
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://