Random thoughts shooting out of volatile mind
Working with SOAP service using KSOAP from Blackberry
You can easily work with any web service from  using KSOAP library. Here i'm giving a sample code on how to do that. I'm not going to explain anything though ;)
String serviceUrl = "Replace with URL to webservice";
String serviceNameSpace = "Replace with namespace of web service";
String soapAction = "URL to method name";
String methodName = "Replace with Name of method";
SoapObject rpc = new SoapObject(serviceNamespace, methodName);
rpc.addProperty("number1", 10);
rpc.addProperty("number2", 20);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet = true;//IF you are accessing .net based web service this should be true
envelope.encodingStyle = SoapSerializationEnvelope.ENC;
HttpTransport ht = new HttpTransport(serviceUrl);
ht.debug = true;
ht.setXmlVersionTag("");
int result = null;
try
{
ht.call(soapAction, envelope);
result = (envelope.getResult());
}
catch(org.xmlpull.v1.XmlPullParserException ex2){
}
catch(Exception ex){
String bah = ex.toString();
}
Just note that SoapSerializationEnvelope.dotNet should be set to true for .NET based web service.
Posted by: copyninja on Monday, 23 November 2009

blog comments powered by Disqus
Fork me on GitHub