Consume SOAP Web Services in Mobile Apps

Mobile applications were probably not considered most when SOAP was originated in 90s by Microsoft staff.  It is usually impractical, or at least, not optimal for mobile applications to host SOAP services, but it is perfectly practical for mobile applications to consume SOAP web services if the apps are configured properly.

Among the three major viable mobile OS's - Windows Phone (WP), Android, iOS, WP is supposed to be best positioned to consume SOAP web services considering Silverlight for WP, the app development platform, includes its version of WCF that supports SOAP.  Testing has shown, WP's Silverlight WCF is implemented differently from Silverlight for other platforms.  It has troubles in dealing with collection parameters. Adding extensions to a client proxy class for WP is a major hassle as of this post .  If a set of highly related Web Services are based on multiple WSDL files and some contain definitions of types referenced by others.  It is the best to avoid redundancy by generating a single service using multiple files so that one will not have the same type in different services (e.g. service1.TypeA, service2.TypeA, service3.TypeA...).

Android inherently lacks the support for SOAP.  CFX is a great service framework for Java supporting SOAP, but unfortunately, Android does not support CFXKsoap2-android sounds great for consuming SOAP services on Android, but it is truly a lightweight library.  It is so light that it cannot do the heavy lifting for developers to deal with the exceptionally heavy protocol SOAP. If Ksoap2-android is used, Java DOM parser should be used if the SOAP messages are relatively small (no more than a few kilo-bytes) which is the case for most SOAP services.

One natural choice for mobile application to consume SOAP is setting up a proxy client using a desirable protocol (e.g. JSON), but this requires that the service souce be accessible to the server running the proxy client.

ksoap2-android-3.2.0 is unusable because it generates java.io.EOFException ocasionally and unpredictably

ksoap2-android-3.0.0 works fine.

ksoap2-android-3.6.2 generates error "com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: okhttp3/Address.class" when building an Android app.  To remedy this, the okhttp3 and okio folders in ksoap2-android-assembly-3.6.2-jar-with-dependencies.jar need to be removed and the following needs to be added to Progurar-project.txt:

-keep class org.xmlpull.v1.** { *; }

-dontwarn org.xmlpull.v1.**

 

This article was updated on 11:24:39 2025-08-18