Java Axis2 客户端的最小类路径是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/320178/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the minimum classpath for an Axis2 client?
提问by Aaron Digulla
I want to build an Axis2 client (I'm only accessing a remote web service, I'm notimplementing one!) with Maven2 and I don't want to add 21MB of JARs to my project. What do I have to put in my pom.xml to compile the code when I've converted the WSDL with ADB?
我想用 Maven2构建一个 Axis2 客户端(我只访问远程 Web 服务,我没有实现一个!),我不想向我的项目添加 21MB 的 JAR。当我用 ADB 转换 WSDL 时,我必须在 pom.xml 中放入什么来编译代码?
采纳答案by Alex
(Note:This response was provided by Aaron Digulla himself. What follows is the exact text of his own answer.)
(注意:此回复由 Aaron Digulla 本人提供。以下是他自己回答的确切文本。)
In maven2, the minimum dependency set to make an ADB client work ("ADB" as in the way you created the Java classes from the WSDL) is this:
在 maven2 中,使 ADB 客户端工作的最小依赖项集(“ADB”就像您从 WSDL 创建 Java 类的方式一样)是这样的:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.4.1</version>
</dependency>
Hmmm... it seems I can't flag that as the correct answer. Can someone please copy this so I can flag his post?
嗯...似乎我不能将其标记为正确答案。有人可以复制这个以便我可以标记他的帖子吗?
回答by Sun
If your client is running on Java 6, consider using JAX-WS for consuming the WS. JAX-WS uses the JAXB standard for binding and you don't need a single extra jar for the client.
如果您的客户端在 Java 6 上运行,请考虑使用 JAX-WS 来使用 WS。JAX-WS 使用 JAXB 标准进行绑定,并且您不需要为客户端提供一个额外的 jar。
回答by Luís Duarte
Actually, you only need the axis-abddependency since the axis2-kernelis a sub-dependency of axis-abd. Therefore you can sum it up with:
实际上,您只需要axis-abd依赖项,因为axis2-kernel是axis-abd的子依赖项。因此,您可以总结为:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.5.1</version>
</dependency>
回答by Mark O'Connor
In Axis2 version 1.5.1 the maven modules appear to have been restructured.
在 Axis2 版本 1.5.1 中,maven 模块似乎已被重组。
My Groovy scripts (Using ADB binding) have the following dependencies:
我的 Groovy 脚本(使用 ADB 绑定)具有以下依赖项:
@Grapes([
@Grab(group='org.apache.axis2', module='axis2-kernel', version='1.5.1'),
@Grab(group='org.apache.axis2', module='axis2-adb', version='1.5.1'),
@Grab(group='org.apache.axis2', module='axis2-transport-local', version='1.5.1'),
@Grab(group='org.apache.axis2', module='axis2-transport-http', version='1.5.1'),
])
There's a logic to these. I could use an alternative binding framework when generating my stub or could use an alternative transport protocol to HTTP.
这些都是有逻辑的。我可以在生成存根时使用替代绑定框架,或者可以使用 HTTP 的替代传输协议。
Example code in this answer
此答案中的示例代码
回答by Late_But_May_Help_Someone
The minimum jars for the client are:
客户端的最小 jars 是:
- activation-1.1.jar
- axiom-api-1.2.8.jar
- axiom-impl-1.2.8.jar
- axis2-adb-1.5.1.jar
- axis2-kernel-1.5.1.jar
- axis2-transport-http-1.5.1.jar
- axis2-transport-local-1.5.1.jar
- commons-codec-1.3.jar
- commons-httpclient-3.1.jar
- commons-logging-1.1.1.jar
- httpcore-4.0.jar
- mail-1.4.jar
- neethi-2.0.4.jar
- wsdl4j-1.6.2.jar
- XmlSchema-1.4.3.jar
- 激活-1.1.jar
- axiom-api-1.2.8.jar
- axiom-impl-1.2.8.jar
- axis2-adb-1.5.1.jar
- axis2-kernel-1.5.1.jar
- axis2-transport-http-1.5.1.jar
- axis2-transport-local-1.5.1.jar
- commons-codec-1.3.jar
- commons-httpclient-3.1.jar
- commons-logging-1.1.1.jar
- httpcore-4.0.jar
- 邮件1.4.jar
- neethi-2.0.4.jar
- wsdl4j-1.6.2.jar
- XmlSchema-1.4.3.jar
STAX jars below are not part of Axis2 1.5.1 release and will be needed if your JDK version is less than 6:
下面的 STAX jar 不是 Axis2 1.5.1 版本的一部分,如果您的 JDK 版本低于 6,则将需要它们:
- stax-1.2.0.jar
- stax-api-1.0.1.jar
- stax-1.2.0.jar
- stax-api-1.0.1.jar
回答by Renaud
Had to add the transports, too
也必须添加传输
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.5.4</version>
</dependency>
回答by chrisjleu
Axis2 version 1.6.2 wouldn't work for me without axis2-xmlbeans(though this may have something to do with the fact that I'm also using the axis2-wsdl2code-maven-pluginplugin and xmlbeans as my data binding framework). I have the following POM:
如果没有axis2-xmlbeans,Axis2 版本1.6.2 对我不起作用(尽管这可能与我还使用axis2-wsdl2code-maven-plugin插件和xmlbeans 作为我的数据绑定框架这一事实有关)。我有以下 POM:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.6.2</version>
</dependency>
回答by IvanRF
For those using Gradle, here I exclude unnecessary libraries:
对于那些使用Gradle 的人,这里我排除了不必要的库:
dependencies {
ext.compileEx = { lib, exModules, exGroups ->
compile (lib) {
exModules.each { exclude module : "$it" }
exGroups.each { exclude group: "$it" }
}
}
List axisExModules = [ 'axiom-compat', 'jaxen', 'apache-mime4j-core' ]
List axisExGroups = [ 'javax.servlet', 'commons-fileupload', 'org.apache.woden',
'javax.ws.rs', 'org.apache.geronimo.specs', 'org.codehaus.woodstox' ]
compileEx ('org.apache.axis2:axis2-adb:1.6.3', axisExModules, axisExGroups)
compileEx ('org.apache.axis2:axis2-transport-local:1.6.3', axisExModules, axisExGroups)
compileEx ('org.apache.axis2:axis2-transport-http:1.6.3', axisExModules, axisExGroups)
}
Hereis my original post in the Gradle forums.
这是我在 Gradle 论坛上的原始帖子。
回答by somshivam
Minimal dependency for a working client in summary
工作客户端的最小依赖性总结
- axiom-api-1.2.14.jar
- axiom-impl-1.2.14.jar
- axis2-adb-1.6.3.jar
- axis2-kernel-1.6.3.jar
- axis2-transport-http-1.6.3.jar
- axis2-transport-local-1.6.3.jar
- commons-codec-1.3.jar
- commons-httpclient-3.1.jar
- commons-logging-1.1.1.jar
- httpcore-4.0.jar
- mail-1.4.jar
- neethi-3.0.2.jar
- wsdl4j-1.6.2.jar
- XmlSchema-1.4.7.jar
- axiom-api-1.2.14.jar
- axiom-impl-1.2.14.jar
- axis2-adb-1.6.3.jar
- axis2-kernel-1.6.3.jar
- axis2-transport-http-1.6.3.jar
- axis2-transport-local-1.6.3.jar
- commons-codec-1.3.jar
- commons-httpclient-3.1.jar
- commons-logging-1.1.1.jar
- httpcore-4.0.jar
- 邮件1.4.jar
- neethi-3.0.2.jar
- wsdl4j-1.6.2.jar
- XmlSchema-1.4.7.jar
Listed below the minimal dependencies with details
下面列出了带有详细信息的最小依赖项
client stub uses the ServiceClient Class generated with %AXIS2_HOME%\bin\WSDL2Java tool against a given WSDL (for generating you would need all axis jars on classpath, achieved most easily by setting AXIS_HOME)
客户端存根使用通过 %AXIS2_HOME%\bin\WSDL2Java 工具生成的 ServiceClient 类针对给定的 WSDL(为了生成您需要类路径上的所有轴 jar,通过设置 AXIS_HOME 最容易实现)
Classes required by Client stub at COMPILEtime
客户端存根在编译时所需的类
- axiom-api-1.2.14.jar -- required at compilation time by client stub for org.apache.axiom.om.OMElement, org.apache.axiom.soap.SOAPEnvelope, org.apache.axiom.soap.SOAPFactory, org.apache.axiom.om.OMNamespace
- axis2-adb-1.6.3.jar -- required at compilation time by client stub for org.apache.axis2.databinding.ADBException
- axis2-kernel-1.6.3.jar -- required at compilation time by client stub for org.apache.axis2.AxisFault Class
- axiom-api-1.2.14.jar -- org.apache.axiom.om.OMElement、org.apache.axiom.soap.SOAPEnvelope、org.apache.axiom.soap.SOAPFactory、org的客户端存根在编译时需要.apache.axiom.om.OM 命名空间
- axis2-adb-1.6.3.jar -- org.apache.axis2.databinding.ADBException 的客户端存根在编译时需要
- axis2-kernel-1.6.3.jar -- org.apache.axis2.AxisFault 类的客户端存根在编译时需要
Classes required for successful invocation of Client stub at RUNtime
在运行时成功调用客户端存根所需的类
- axiom-impl-1.2.14.jar (without this org.apache.axiom.om.OMException: No meta factory found for feature 'default'; this usually means that axiom-impl.jar is not in the classpath)
- axis2-transport-http-1.6.3.jar (without this org.apache.axis2.deployment.DeploymentException: org.apache.axis2.transport.http.CommonsHTTPTransportSender)
- axis2-transport-local-1.6.3.jar (without this org.apache.axis2.deployment.DeploymentException: org.apache.axis2.transport.local.LocalTransportSender)
- commons-codec-1.3.jar (without this java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException)
- commons-httpclient-3.1.jar (without this org.apache.axis2.deployment.DeploymentException: org/apache/commons/httpclient/HttpException)
- commons-logging-1.1.1.jar (without this java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory)
- httpcore-4.0.jar (without this java.lang.NoClassDefFoundError: org/apache/http/HttpResponseFactory)
- mail-1.4.jar (without this java.lang.NoClassDefFoundError: javax/mail/internet/ParseException)
- neethi-3.0.2.jar (without this java.lang.NoClassDefFoundError: org/apache/neethi/PolicyComponent)
- wsdl4j-1.6.2.jar (without this java.lang.NoClassDefFoundError: javax/wsdl/WSDLException)
- XmlSchema-1.4.7.jar (without this java.lang.ClassNotFoundException: org/apache/ws/commons/schema/XmlSchema)
- axiom-impl-1.2.14.jar(没有这个 org.apache.axiom.om.OMException: 没有找到功能“默认”的元工厂;这通常意味着 axiom-impl.jar 不在类路径中)
- axis2-transport-http-1.6.3.jar(没有这个 org.apache.axis2.deployment.DeploymentException: org.apache.axis2.transport.http.CommonsHTTPTransportSender)
- axis2-transport-local-1.6.3.jar(没有这个 org.apache.axis2.deployment.DeploymentException:org.apache.axis2.transport.local.LocalTransportSender)
- commons-codec-1.3.jar (没有这个 java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException)
- commons-httpclient-3.1.jar(没有这个 org.apache.axis2.deployment.DeploymentException: org/apache/commons/httpclient/HttpException)
- commons-logging-1.1.1.jar (没有这个 java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory)
- httpcore-4.0.jar(没有这个 java.lang.NoClassDefFoundError: org/apache/http/HttpResponseFactory)
- mail-1.4.jar(没有这个 java.lang.NoClassDefFoundError: javax/mail/internet/ParseException)
- neethi-3.0.2.jar(没有这个 java.lang.NoClassDefFoundError: org/apache/neethi/PolicyComponent)
- wsdl4j-1.6.2.jar(没有这个 java.lang.NoClassDefFoundError: javax/wsdl/WSDLException)
- XmlSchema-1.4.7.jar(没有这个 java.lang.ClassNotFoundException: org/apache/ws/commons/schema/XmlSchema)
org.apache.axis2.AxisFault: Connection refused: connect -> ERROR ONLY if the web service is not up or accessible for some other reason
org.apache.axis2.AxisFault:连接被拒绝:仅当 Web 服务未启动或由于其他原因无法访问时才连接 -> 错误
Note the exact version(s), however behavior would be generic enough subject to packaging changes across version, hence, mentionined the FQCNs above-
请注意确切的版本,但是由于跨版本的包装更改,行为将足够通用,因此,上面提到了 FQCN-
Axis Version - 1.6.3
轴版本 - 1.6.3
Tomcat Version - Apache Tomcat/7.0.64
Tomcat 版本 - Apache Tomcat/7.0.64
Servlet version - 3.0
Servlet 版本 - 3.0
java.runtime.version - 1.7.0_79-b15
java.runtime.version - 1.7.0_79-b15