我正在寻找替代 SOAP (javax.xml.soap
) 实现,而不是 Sun SAAJ 。原因是因为我想在 IBM JDK 5 驱动的 Tomcat AS 上部署 JAX-WS WebService,但已知问题是 Sun SAAJ 实现依赖于重新分配的 Xerces 类(请参阅 Ref Impl 不适用于 IBM JDK 和 SAAJ 测试用例不再与 IBM 的 SDK 一起使用),唯一的出路是使用自定义 Maven 配置文件来拉取 com.sun.xml.parsers:jaxp-ri
如下:
<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>
我想放弃此配置文件,只需将 SOAP 实现替换为在任何地方都适用的实现。
我想供应商 SOAP 实现可能会附带 Apache Axis / Apache CXF(基于 IBM SOAP4J)或 JBoss AS – 请根据我的喜好提供信息:
- 实施应该易于与其他人员分离(最好是一轻质罐子)。
- 实现应支持带有附件的 SOAP 消息。
- 实现应该与 Java5 字节码兼容。
- 如果 Maven Central 中可以实现,这是一个优点。
参考资料:
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:
发布评论
评论(3)
经过浏览后,我得出了以下问题的潜在解决方案。我已经使用 javax.xml.soap.MessageFactory 的后代是什么href="http://grepcode.com/search/usages?type=type&k=d&id=repository.grepcode.com%24java%24root%40jdk%24openjdk%406-b14%40javax%24xml%24soap%40MessageFactory ">grepcode.com。
除了标准的 com.sun.xml.messaging.saaj.soap.MessageFactoryImpl 之外,我还发现(如假设的那样):
org.apache.axis2:axis2-saaj:1.6.1
。此 JAR 通过META-INF\services\javax.xml.soap.MessageFactory
和META-INF\services\javax.xml.soap.MetaFactory
正确声明工厂,因此没有还需要其他调整。这个版本(根据Maven Central)是2011年发布的,依赖很少,推荐。org.jboss.ws.native:jbossws-native-core:3.2.1.Beta2
中的org.jboss.ws.core.soap.MessageFactoryImpl
。看起来相当旧,也许 JBoss 不再支持它的开发,因为我能够在 Maven Central 之外找到这个 jar (此处)。依赖很多,1.8M大小,不推荐。org.apache.openejb:openejb-webservices:4.0.0-beta-2
和org.apache.geronimo.modules:geronimo-webservices:3.0-M1
。实际上,这些工厂中的任何一个都是 Axis2 或 Sun 实现的包装器/运行时定位器(请参阅SaajFactoryFinder
和SAAJFactoryFinder
)。不予考虑。底线:唯一可接受的替代方案是 Axis2 实现。
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
inorg.apache.axis2:axis2-saaj:1.6.1
. This JAR correctly announces the factories viaMETA-INF\services\javax.xml.soap.MessageFactory
andMETA-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
inorg.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
inorg.apache.openejb:openejb-webservices:4.0.0-beta-2
andorg.apache.geronimo.webservices.saaj.GeronimoMessageFactory
inorg.apache.geronimo.modules:geronimo-webservices:3.0-M1
. In reality either of these factories is a wrapper/runtime_locator for Axis2 or Sun implementations (seeSaajFactoryFinder
andSAAJFactoryFinder
). Not to be considered.Bottom line: The only acceptable alternative is Axis2 implementation.
虽然我不知道您的确切问题的答案,但我有一个解决方案,如何使 Sun SAAJ(和 JAX-WS RI)在 JRE 1.5 下工作。在Java 5下运行JAX-WS RI出现问题的原因确实是过时的JAXP(Java 1.5附带JAXP 1.3,而JAX-WS RI需要JAXP 1.4),而且因为JAX-WS RI是硬编码使用的Sun JAXP RI (com.sun.org.apache...)。由于 JAXP 1.3 是 JRE 的一部分,因此您不能简单地替换它(您可以替换实现,但不能替换 API)。
解决方案是 activesoap 的 xerces 端口,它是一个简化的 JAXP 1.4 版本,使用 Sun JAXP RI 包命名 (com.sun.org.apache.)。
您可以在 Maven 存储库中找到它:
不要介意奇怪的包命名 - 只需尝试一下即可。
这通常是在 Java 5 下运行 Sun JAX-WS RI(以及作为其中一部分的 SAAJ)所需的全部内容。
不要忘记不要包含任何 JAXP API JAR。它们将与 Java 5 JAXP API 发生冲突。
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:
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.
很难的一个。也许看看 Apache CXF 版本之一。 http://cxf.apache.org/
您可能想尝试翻转类加载器,捆绑您需要的 jar 文件需要与您的网络应用程序一起加载并加载到 PARENT_LAST 模型中。这可能是您最好的选择。
Tomcat 中的第三个选项可能是 Java 和 Tomcat 中支持的认可标准覆盖机制。
-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS
看这里,我认为它适用于旧版本的 Tomcat:http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html#XML_Parsers_and_Java。
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.