This tutorial outlines difference (comparison) between WSClient++ and KSoap tool to connect web services.

Sample Web Service

Lets consider a very simple web service, that will return simple “Hello World” string.

KSoap Web Service Call for Android

KSoap2 Call on Android
  1. private static final String SOAP_ACTION = "";
  2. private static final String METHOD_NAME = "HelloWorld";
  3. private static final String NAMESPACE = "";
  4. private static final String URL = "http://localhost/TestWeb/WebService.asmx";
  6. public object GetResponse() throws Exception
  7. {
  8.     SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  9.     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
  10.     envelope.dotNet=true;
  11.     envelope.setOutputSoapObject(request);
  13.     HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
  15., envelope);
  17.     Object result = (Object)envelope.getResponse();
  18. }

Wow, you can see just to call one method, there is 18 lines of code. Well unfortunately you have to write this manually.

WSClient++ Web Service call for Android

WSClient++ generates source code that does all SOAP parsing/encoding for you on the fly. And the code that you have to use in your project will be as small as below,

WSClient++ call on Android
  1. public object GetResponse() throws Exception
  2. {
  3.     HelloWorldService service = new HelloWorldService();
  4.     service.setBaseUrl("http://localhost");
  5.     return service.HelloWorld();
  6. }

The total lines of code is now 6, and that too, actual service call is as small as just one line. However, in order to write KSoap call on asynchronous, you have to wrap your code around AsyncTask and write more code, where else with WSClient++ it is very easy to write asynchronous call, which works perfect without any hassle.

Async call on Android
  1. public void GetResponseAsync() throws Exception
  2. {
  3.     HelloWorldService service = new HelloWorldService();
  4.     service.setBaseUrl("http://localhost");
  5.     service.HelloWorld(
  6.         new service.HelloWorldResponse(
  7.             {
  8.                 public void onResult(string s){
  10.                 }
  11.                 public void onError(Exception ex){
  13.                 }
  14.             }
  15.     )
  16.     );
  17. }


  WSClient++ KSoap
Automatic Code Generator YES NO
Automatic Type (Class) generation for every Soap Input/Output YES NO
Class with IParcelable Implementation YES NO
On the fly Encoding YES NO
Memory Footprint Small Big
Execution Time on Client Small Big
.NET Service Call Detection Auto Manual
Automatic Asynchronous Call Class Generator YES NO