I have an ASMX webservice setup on Microsoft Azure and I'm trying to
send data to the webservice and receive output using an android
application. For this purpose, I am using the KSOAP library.
On the webservice, I'm checking if the strings are null. If they are,
I return an error code "2405"
[WebMethod]
public string LoginUser(string auth_token, string username)
{
// All these tests performed, so someone from outside of
out application
// scope does not attempt to abuse our webservice.
#region Check for nulls
if (string.IsNullOrEmpty(auth_token))
return "2405";
if (string.IsNullOrEmpty(username))
return "2405";
#endregion
}
In my android application, I am sending the data, but the webservice
still returns the 2405 error code, which means that the data is not
sent.
The following is my android code:
SoapObject request = new SoapObject(NAMESPACE, method_name);
request.addProperty("auth_token","TestAuth");
request.addProperty("username","TestUser");
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new
HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
Sorry that I can provide you with the namespace, methodname, url, etc.
It is against the company policy and I hope you understand. :)
Nevertheless, I'll go over the error again. After calling the above
Android code, the webservice returns 2405, which according to the ASMX
code is when any of the twos values are null.
I debugged the SOAP request (androidHttpTransport.debug = true) and
got the following results for the requestDump and responseDump.
REQUEST DUMP
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:d="http://www.w3.org/2001/XMLSchema"
xmlns:c="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<LoginUser xmlns="http://tempuri.org" id="o0" c:root="1">
<auth_token i:type="d:string">TestAuth</auth_token>
<username i:type="d:string">TestUser</username>
</LoginUser>
</v:Body>
</v:Envelope>
RESPONSE DUMP:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LoginUserResponse xmlns="http://tempuri.org/">
<LoginUserResult>2405</LoginUserResult>
</LoginUserResponse>
</soap:Body>
</soap:Envelope>
Please help me out here.
Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en