dma_k
dma_k

Reputation: 10639

Alternative to Sun SAAJ SOAP implementation

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:

References:

Upvotes: 11

Views: 18443

Answers (3)

dma_k
dma_k

Reputation: 10639

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.

Upvotes: 7

TechTrip
TechTrip

Reputation: 4537

Tough one. Perhaps look at one of the Apache CXF releases. http://cxf.apache.org/

You may want to try flipping the classloader, bundling the jars that you need with your web app and loading in a PARENT_LAST model. This is probably your best bet.

A third option in Tomcat could be the Endorsed Standards Override Mechanism supported in Java, and Tomcat. -Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS

See here, I think it applied to older versions of Tomcat: http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html#XML_Parsers_and_Java.

Upvotes: 0

rustyx
rustyx

Reputation: 85256

Although I do not know the answer to your exact question, I have a solution how you can make Sun SAAJ (and JAX-WS RI) work under JRE 1.5. The reason why there are troubles with running JAX-WS RI under Java 5 is indeed the outdated JAXP (Java 1.5 comes with JAXP 1.3, while JAX-WS RI requires JAXP 1.4), AND because JAX-WS RI is hard-coded to use the Sun JAXP RI (com.sun.org.apache...). Since JAXP 1.3 is part of the JRE, you can't simply replace it (you can replace the implementation, but not the API). The solution is the activesoap's xerces port, which is a cut-down JAXP 1.4 version that uses Sun JAXP RI package naming (com.sun.org.apache.). You can find it in the Maven repo:

<dependency>
    <groupId>activesoap</groupId>
    <artifactId>jaxb-xercesImpl</artifactId>
    <version>1.5</version>
</dependency>

Don't mind the strange package naming - just try it.

This is often all that's needed to run the Sun JAX-WS RI (and SAAJ as part of it) under Java 5.

Don't forget NOT to include any JAXP API JARs. They will conflict with the Java 5 JAXP API.

Upvotes: 0

Related Questions