I am having a lot of trouble finding good information on how to call a standard SOAP/WSDL web service with Android. All I've been able to find are either very convoluted documents and references to "kSoap2" and then some bit about parsing it all manually with SAX. OK, that's fine, but it's 2008, so I figured there should be some good library for calling standard web services.
The web service is just basically one created in NetBeans. I would like to have IDE support for generating the plumbing classes. I just need the easiest/most-elegant way to contact a WSDL based web service from an Android-based phone.
I am sure you could make a little SOAP client with Axis. Axis installation instructions.
Few months ago I was working with jax-ws web service in j2ee application, There we were using CXF wsdl2java to generate WS client stub from the WSDL file and with those client stubs we consumed the web services. Few weeks ago, when I was trying to consume the web service in the same way in android platform I couldn't, because the android jar has not all the "jax-ws" supporting classes in it. That time I didn't find any such tool ( if I wasn't failed to google efficiently) to meet my requirement --
So, I developed my own Android SOAP Client Generation Tool. Where you have to follow these steps :
eg:
You can have a look at WSClient++
It's true that due to it's overhead SOAP is not the best choice for data exchange with mobile devices. However, you might find yourself in situation in which you do not control the format of server output.
So, if you have to stick with SOAP, there is a kSOAP2 library patched for Android here:
http://code.google.com/p/ksoap2-android/
To call a web service from a mobile device (especially on an Android phone), I have used a very simple way to do it. I have not used any web service client API in attempt to call the web service. My approach is as follows to make a call.
HttpURLConnection
.getResonseCode
).ErrorInput
stream on same HTTPobject and receive the error if any.I have implemented this procedure for the Android phone, and it is successfully running. I am able to parse the response even if it is more than 700 KB.
org.apache.http.impl.client.DefaultHttpClient
comes in the Android SDK by default. That'll get you connected to the WSDL.