Java – Alternative to Sun SAAJ SOAP implementation

javajax-wssoapweb services

I am looking for alternative SOAP (javax.xml.soap) implementation, other than Sun SAAJ. The reason for that is because I would like to deploy JAX-WS WebService on IBM JDK 5 driven Tomcat AS, but it is known problem that Sun SAAJ implementation depends on reallocated Xerces classes (see Ref Impl does not work with IBM JDK and SAAJ test cases no longer work with IBM's SDK) and the only way out for that is to use a custom Maven profile to pull com.sun.xml.parsers:jaxp-ri like:

<profiles>
    <profile>
        <id>pre-jdk5-profile</id>

        <activation>
            <jdk>(,1.4]</jdk>
        </activation>

        <dependencies>
            <dependency>
                <groupId>com.sun.xml.parsers</groupId>
                <artifactId>jaxp-ri</artifactId>
                <scope>runtime</scope>
            </dependency>
        </dependencies>
    </profile>
</profiles>

I would like to drop this profile and simply replace SOAP implementation with one that works everywhere.

I suppose that vendor SOAP implementations may come with Apache Axis / Apache CXF (which is based on IBM SOAP4J) or JBoss AS – please provide information based on my preferences:

  • Implementation should be easy to separate from the rest staff (preferably one light-weighted jar).
  • Implementation should support SOAP messages with attachments.
  • Implementation should be Java5 bytecode compatible.
  • If implementation is available in Maven Central, this is a plus.

References:

Best Answer

After browsing around I have come the the following potential solution of the problem. I have explored what are the descendants of javax.xml.soap.MessageFactory using grepcode.com.

Apart from standard com.sun.xml.messaging.saaj.soap.MessageFactoryImpl, I have found (as supposed):

  • org.apache.axis2.saaj.MessageFactoryImpl in org.apache.axis2:axis2-saaj:1.6.1. This JAR correctly announces the factories via META-INF\services\javax.xml.soap.MessageFactory and META-INF\services\javax.xml.soap.MetaFactory so no other tuning is needed. This version (according to Maven Central) was released in 2011, few dependencies, recommended.
  • org.jboss.ws.core.soap.MessageFactoryImpl in org.jboss.ws.native:jbossws-native-core:3.2.1.Beta2 from JBoss 3.x. Looks to be rather old and perhaps JBoss is not supporting it's development anymore as I was able to find this jar outside maven central (here). A lot of dependencies, 1.8M size, not recommended.
  • org.apache.openejb.server.webservices.saaj.MessageFactoryImpl in org.apache.openejb:openejb-webservices:4.0.0-beta-2 and org.apache.geronimo.webservices.saaj.GeronimoMessageFactory in org.apache.geronimo.modules:geronimo-webservices:3.0-M1. In reality either of these factories is a wrapper/runtime_locator for Axis2 or Sun implementations (see SaajFactoryFinder and SAAJFactoryFinder). Not to be considered.

Bottom line: The only acceptable alternative is Axis2 implementation.