Hi everyone,
I have the following code which invokes a .net webservice. The code connects to the service fine, but the paramter(deviceid) does not appear to get passed. The method simply returns the passed deviceid which is always null.
This is telling me the deviceid parameter is not being passed. I thought I saw someone recommend a packet sniffer to view the outgoing xml, but can't seem to remember what it was. Can someone suggest one that i can use in conjunction with eclipse and windows.
activity code
String deviceid = tManager.getDeviceId();
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
PropertyInfo pi = new PropertyInfo();
pi.setName("deviceid");
pi.type = PropertyInfo.STRING_CLASS;
pi.setValue(deviceid.toString());
request.addProperty(pi);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(URL);
try{
ht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive result = (SoapPrimitive ) soapEnvelope.getResponse();
Toast.makeText(ctx, "result = " + result.toString(), Toast.LENGTH_SHORT).show();
}catch(Exception e){
e.printStackTrace();
Toast.makeText(ctx, "error: " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
webservice code
<WebMethod()> _
Public Function CheckTrial(ByVal deviceid As String) As String
Return deviceid
End Function
I,ve tried everything and cannot figure out how to resolve this. Does anyone else have any suggestions to try?
xml sent as spy'ed from wire shark:
POST /android_service_test.asmx HTTP/1.1
Host: ikonicsoft.com
user-agent: kSOAP/2.0
soapaction: http://ikonicsoft.com/CheckTrial
content-type: text/xml
connection: close
content-length: 421
<?xml version="1.0" encoding="UTF-8"?>
<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>
<CheckTrial xmlns="http://ikonicsoft.com" id="o0" c:root="1">
<deviceid i:type="d:string">000000000000000</deviceid>
</CheckTrial>
</v:Body>
</v:Envelope>
HTTP/1.1 200 OK
Connection: close
Date: Mon, 21 Jun 2010 16:35:10 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: PleskWin
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: .ASPXANONYMOUS=fnyqjfFHywEkAAAAZGVjYjZmNTEtNWNiYi00YTIwLWEzYzktNzUxZDNjMDA0OGY00;
expires=Mon, 30-Aug-2010 03:15:09 GMT; path=/; HttpOnly
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 299
<?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>
<CheckTrialResponse xmlns="http://ikonicsoft.com/" />
</soap:Body>
</soap:Envelope>
Thanks
Patrick