Call .NET Webservice with Android Call .NET Webservice with Android json json

Call .NET Webservice with Android


I cannot talk much about the JSON solution. But I've been working with SOAP on Android for a while.

Here are my comments regarding the SOAP solution.

  1. The most popular library that I've found for doing SOAP on Android devices is kSOAP.
  2. The default kSOAP library doesn't provide a way to generate Java classes from a WSDL. It is a big problem if you have a WSDL with a lot of method. I found a project (http://en.sourceforge.jp/projects/sfnet_wsdl2ksoap2/) that "claims" to do it. NOTE: I've not used this successfully yet. I discovered it after I had implemented the current version of my code.
  3. XML parsing has an overhead and sometimes it can be a problem. The parsing overhead will depend on your application context and performance requirements. Currently, I'm getting acceptable performance by using SOAP to send video frames (SOAP containing base64 encoded MJPEG frames.) For large messages parsing time on a Nexus One are of the order of a 150-200 ms (depending on the message size.)

This may be unrelated but I found this Google I/O session on building RESTFul applications for Android useful. I think they also released a JSON API in 2.2

Hope this helps.


I have been working on something similar myself, and although I may not be the best authority on this, I would say 9 times out of 10 JSON is the way you want to go. Not that soap doesn't have it's place, but for most things JSON will be simpler, and if it doesn't look that way it's more likely that your service needs refactoring rather than having a genuinely complex domain to represent.

The added bonus ofcourse is if you want to use the same service on iPhone, Blackberry, WinMo7, Ajax website, or really anywhere else, it will be much much better for you :-)

My $0.02