Skip to end of metadata
Go to start of metadata

Blog?

Blog stream

Create a blog post to share news and announcements with your team and company.

What?

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

But... this is only a proof-of-concept library, I've tested it with JBoss WebService stack, see and/or try the example.

Why?

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

How?

 /**
  * 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();
 }

Can you see? The lists are lists, the classes are classes, the values are in the properties, just like in the JAX-WX client... (smile)

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

<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 of the android-maven-plugin:

<dex>
  <coreLibrary>true</coreLibrary>
</dex>

Where?

Source: http://svn.javaforum.hu/svn/android/AndroidSOAP/trunk/

Wiki: http://wiki.javaforum.hu/display/ANDROIDSOAP/Home

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

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

Tutorial?

Step by step tutorial with Maven3 project: Step by Step Tutorial

Patches and feature requests?

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 Maven, if you aren't using Maven, you need some jars to add your project's CLASSPATH:

Example screenshot

      
      
Page viewed times
#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))

29 Comments

  1. Anonymous

    Interesting project. I tried to make it work here, but bumped into issues with javax.xml.bind package. I noticed that these imports are present in your source code generated by wsimport as well. How do you get this to compile and run on Android without adding a library like JAXB? Thanks.

    1. Hi,

      The javax.xml.bind.* classes are annotations... and some other classes (*Bean, *BeanService, ObjectFactory and etc.) are not used in the Android side of the projects, so the JAXB is not neccessary... (smile)

      1. Tim

        I'm also interested in your project. Which jar files need adding to the android project in order to get it to build in Eclipse? Where can I get them? Thanks  (smile)

        1. The project can build with Maven, so you can build it with a Maven plugin for Eclipse: m2eclipse or Eclipse IAM.

          You can checkout the entire project from the http://svn.javaforum.hu/svn/android/AndroidSOAP/trunk/AndroidSOAP/ address, and you can build it instantly. (smile)

    2. You want to generate beans without any xml databinding code baked in, so don't use JAXB (xjc) or wsimport to generate your beans.  Try using the wsdl2java utility from the Apache Axis project:

      http://ws.apache.org/axis/index.html

      ...then use this script:

      http://code.activestate.com/recipes/577533-axis-pojo-stripper/

      to post-process the Axis beans to generate plain beans (POJOs without marshal/unmarshalling code)

  2. Anonymous

    Sounds interessting, but could you provide an example how to use the autogenerated files from wsimport.

  3. Anonymous

    Hi! Jo here!

    How do I use your library in Eclipse? How do I compile your example?

    I have installed m2eclipse and checked out the source from svn (http://svn.javaforum.hu/svn/android/AndroidSOAP/trunk/AndroidSOAP/), but Eclipse doesn't detect any projects.

    I want to use your library for a project at university.

    Thanks in advance!

    Jo from Germany

    1. Hm... the Maven project is very simple: the pom.xml holds all neccessary data... so the Eclipse must be open it, if the plugin works...

  4. Anonymous

    Jo again:

    For your information: Of course I have installed the Android Plugin for Eclipse too. And I created projects for Android.

    Greetings from Germany!

    1. Anonymous

      Hi! Luke from Italy here.

      This library sounds really interesting, so I have installed Eclipse IAM and checked out the source from svn.

      But I can't understand how to make it work... I believed that the source code contained a running example of an Android app using the library, but I can't find it.

      Forgive me if this is a silly question since I'm totally new both to maven and to Android development!

      Could you share your knowledge about how to setup an Android project that makes use of the AndroidSOAP library?

      Thanks in advance.

  5. This is a great library. I found it to be more usable then ksoap2.  However...  I had to patch it to deal with certain idiosyncrasies of document-literal/wrapped as well as certain web services that require a "SOAPAction" http header.  If you're interested in these patches, let me know.

    1. Thank you for your feedback, send me the patches. (smile)

      1. patches sent to the email address in your profile.  Additional changes handle primitive types other then String also object array fields.  There are still issues, as mentioned in my email.

  6. Anonymous

    Netbeans from version 6.7 amd up, can upen/compile Maven projects too.

  7. Hi, i tried to build the library i got:

    The POM for extreme_xpp3:xpp3:jar:1.1.3.4.D is missing, no dependency information available

    Failed to execute goal on project AndroidSOAP-lib: Could not resolve dependencies for project hu.javaforum.android.androidsoap:AndroidSOAP-lib:jar:0.0.4-SNAPSHOT: Could not find artifact extreme_xpp3:xpp3:jar:1.1.3.4.D in javaforum (http://nexus.javaforum.hu/nexus/content/repositories/public/)

    i need a little help. Thanks.

    1. Which Maven version exactly? Can you try it from command line?

  8. Problem solved. I download the http://www.extreme.indiana.edu/dist/java-repository/xpp3/distributions/xpp3-1.1.3.4.D_all.tgz manually. extracted to netbeans/java/maven/lib restart build. no success..

    i right clicked on the runtime dependencies/xpp3-1.1.3.4.D.jar and selected: manually install artefact. file choosen, build restarted-> fine. it works. Problem solved..:)

  9. Hello!

    I'm very interested in your project!

    Can't you please provide a compiled jar, I've had several troubles trying to create it. Now that I've made it, I still don't know how to use it in my project. Importing it in the project does not solve the import requirements of my wsimport-ed classes.

    I appreciate your help!

    Fra.

    1. Nothing yet, I've managed to create the class files, but when I import them into my Android project, it still gives me the error:

      The type javax.xml.bind.annotation.XmlNsForm cannot be resolved. It is indirectly referenced from required .class files

      How can I solve this problem?

      1. Hm... I think, your Eclipse is too intelligent... the javax.xml.bind.annotation.* isn't exists on Android platform, but it not necessary to run the project on Android. I don't use Eclipse, I'm using NetBeans and pure Maven, so I can't help you... (sad)

        1. Why is it not necessary? It says that some of the classes (the .class files generated) I imported require that library in order to work. I'm confused. :-|

          1. The javax.xml.bind.annotation.* annotations are generated by JAX-WS, but the AndroidSOAP is not use these annotations. If you build the example project with Maven, you can see it.

            1. okay, but don't I have to import in my project the classes wsimported with maven? and don't they include those refrrences?

              thank you!

              By the way, the .pom files do not have the versions of the used plugins, so Maven 3.0 gives some warning.
              Once I fixed that, Eclipse is continuing to give me errors when I import the project, such as:

              No marketplace entries found to handle jaxws-maven-plugin:1.10:wsimport in Eclipse.  Please see Help for more information.

              No marketplace entries found to handle maven-android-plugin:2.5.2:dex in Eclipse.  Please see Help for more information.

              No marketplace entries found to handle maven-android-plugin:2.5.2:generate-sources in Eclipse.  Please see Help for more information.

              1. In the end, I haven't been able to use AndroidSOAP.

  10. Anonymous

    Hello, I tried the apk and nothing happend. I can see 2 buttons on the ui but clicking them does not "as far as i can see" trigger anything. I am missing something? Thank you.

  11. Anonymous

    Great library, finaly something tiny and easy to use. I had to patch it a bit to make it working with enum types and to parse and throw custom SOAP exceptions, however it is working fine now. Thank you.

    1. Thank you... (smile)

      Could you send me your patch? I will merge it into the next version.

      1. Anonymous

        Patches sent to the email address in your profile.

  12. Anonymous

    It still doesn't support enum types. Such as:

    @XmlType(name = "ServiceType")
    @XmlEnum
    public enum ServiceType {
        @XmlEnumValue("Unknown")
        UNKNOWN("Unknown"),
        @XmlEnumValue("Service-FC")
        SERVICE_FC("Service-FC"),
     ...
    }

    In the SOAP request, "Service-FC" should be the field value being sent, but the library uses SERVICE_FC instead. When the response comes back, the library fails generating the instance of the enum type.

    It is a good library on Android if the enum type is supported. Thanks.