Please help, I have spend days trying to get this to work without any
luck. I am calling a .NET web service with the latest (ksoap2-j2se-
full-2.1.2.jar) build. I can get responces with the servcice returning
basic strings and ints but I cannot get the service to take parameters
in. The code below returns just a "test" from this web method, but
thinks the parameter passed is an empty string. Any help would be
much appreciated as I have wasted close to a week messing with this...
has anyone had success with ksoap and .net web services?
I have followed the common .net tips on the server side code declaring
the web methods as RPC:
[WebMethod]
[System.Web.Services.Protocols.SoapRpcMethod]
public string HelloWorld(string a)
{
return "test" + a;
}
--------------Client code:
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//request.addProperty("a", new String("abc"));
// different way of creating the property
PropertyInfo pi = new PropertyInfo();
pi.type = PropertyInfo.STRING_CLASS;
pi.name = "a";
pi.namespace = NAMESPACE;
request.addProperty(pi, "abc");
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
envelope.dotNet = true;
envelope.encodingStyle = SoapSerializationEnvelope.XSD;
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(URL);
transport .debug = true;
try
{
transport .call(SOAP_ACTION, envelope);
String b = envelope.getResponse().toString();
tv.setText(b);
}
catch (Exception aE)
{
tv.setText(aE.getMessage());
}
------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><HelloWorld
xmlns="http://hunt.org/" id="o0" c:root="1"><n0:a i:type="d:string"
xmlns:n0="http://hunt.org/">abc</n0:a></HelloWorld></v:Body></
v:Envelope>
------response dump
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://hunt.org/" xmlns:types="http://hunt.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body
soap:encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/"><types:HelloWorldResponse><HelloWorldResult
xsi:type="xsd:string">
test
</HelloWorldResult></types:HelloWorldResponse></soap:Body></
soap:Envelope>
Thanks,
Patrick
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---