Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Blog?

Blog Posts
max810
sortcreation
reversetrue
contenttitles

What?

The AndroidSOAP is a "yet another" SOAP client for Android platform, it is compatible with 1.5+ versions and uses Reflection API.

...

Using AndroidSOAP is a very easy way to call a SOAP serviceservices, because it is based on JAX-WS interfaces. You can use all interfaces that the 'wsimport' generates from the WSDL. Short example:

How?

Code Block
themeConfluence
languagejava
 /**
  * Creates a request, it is a JAX-WS generated class
  */
 ListSkinPacksRequest request = new ListSkinPacksRequest();

 /**
  * Put it into a 'request' map
  */ 
 Map<String, Object> parameters = new HashMap<String, Object>();
 parameters.put("request", request);

 /**
  * Create an envelope with namespace and create a body with operation name 'listSkinPacks'
  */
 Envelope envelope = new SimpleEnvelope("http://skinpack.pop.javaforum.hu/");
 envelope.setHeader(new SimpleHeader());
 envelope.setBody(new SimpleBody("listSkinPacks", parameters));

 /**
  * Creates a transport (HTTP or HTTPS) with an optional username/password
  */
 HttpsTransport transport = new HttpsTransport("https://services.power.of.planets.hu/PoP-SkinPack-remote/listSkinPacks",
     "androidsoap.demo@javaforum.hu", "demopassword");
 /**
  * Set the 'trust all' flag, if necessary
  */
 transport.setTrustAll(Boolean.TRUE);

 /**
  * Call a service, the result arrives into the JAX-WS class
  */
 ListSkinPacksResponse response = transport.call(envelope, ListSkinPacksResponse.class);

 /**
  * You can use the result as a normal bean
  */
 for (SkinPackMetadata metadata : response.getReturn().getSkinPacksList())
 {
   String fileName = metadata.getFileName();
   String name = metadata.getName();
 }

...

Warning

If any field has XmlElement annotation in the generated source, you need add jaxb-api into your Android project, like this:

Code Block
<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.2.6</version>
  <scope>compile</scope>
</dependency>

And add coreLibrary into the  configuration the configuration of the android-maven-plugin:

Code Block
<dex>
  <coreLibrary>true</coreLibrary>
</dex>

...

Issues: http://traq.javaforum.hu/browse/ANDROIDSOAP

Example apkAPK: http://nexus.javaforum.hu/nexus/content/repositories/releases/hu/javaforum/android/androidsoap/AndroidSOAP-example/0.0.5/AndroidSOAP-example-0.0.5.apk

...

If you have a patch, don't hesitate, send me as fast you can... (smile)

If you need a feature, create an issue... (smile)

If I'm not using Maven?

The entire project (with dependencies) managed by Maven3Maven, if you aren't using Maven3Maven, you need some jars to add your project's CLASSPATH:

...