Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How to call a SOAP web service on Android

I'm experiencing a great deal of difficulty discovering great data on the most proficient method to call a standard SOAP/WSDL web administration with Android. All I've had the option to discover are either extremely tangled archives and references to "kSoap2" and afterward some piece about parsing it all physically with SAX. Alright, that is fine, yet it's 2008, so I figured there ought to be some acceptable library for calling standard web administrations.

The web administration is simply fundamentally one made in NetBeans. I might want to have IDE support for creating the pipes classes. I simply need the least demanding/most-rich approach to contact a WSDL based web administration from an Android-based telephone.
by

3 Answers

rahul07
Android does not provide any sort of SOAP library. You can either write your own, or use something like kSOAP 2. As you note, others have been able to compile and use kSOAP2 in their own projects, but I haven't had to.

Google has shown, to date, little interest in adding a SOAP library to Android. My suspicion for this is that they'd rather support the current trends in Web Services toward REST-based services, and using JSON as a data encapsulation format. Or, using XMPP for messaging. But that is just conjecture.

XML-based web services are a slightly non-trivial task on Android at this time. Not knowing NetBeans, I can't speak to the tools available there, but I agree that a better library should be available. It is possible that the XmlPullParser will save you from using SAX, but I don't know much about that.
sandhya6gczb
org.apache.http.impl.client.DefaultHttpClient comes in the Android SDK by default. That'll get you connected to the WSDL.

HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet httpGet = new HttpGet("example url" + URL);
HttpResponse response = httpClient.execute(httpGet, localContext);
pankajshivnani123
SOAP is an ill-suited technology for use on Android (or mobile devices in general) because of the processing/parsing overhead that's required. A REST services is a lighter weight solution and that's what I would suggest. Android comes with a SAX parser, and it's fairly trivial to use. If you are absolutely required to handle/parse SOAP on a mobile device then I feel sorry for you, the best advice I can offer is just not to use SOAP.

Login / Signup to Answer the Question.