Axis2的wsdl2java在RPC /编码样式的Web服务上失败

Axis2还有其他选择吗? 或者让它工作的方式(例如,不同的数据绑定)?

Retrieving document at '...'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:53) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224) ... 2 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:50) ... 3 more Caused by: org.apache.axis2.schema.SchemaCompilationException: can not find type {http://schemas.xmlsoap.org/soap/encoding/}Array from the parent schema ... at org.apache.axis2.schema.SchemaCompiler.copyMetaInfoHierarchy(SchemaCompiler.java:1296) at org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1258) at org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1153) at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1097) at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1017) at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:931) at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:766) at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:552) at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1991) at org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1874) at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1081) at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1017) at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:931) at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:766) at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:552) at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1991) at org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1874) at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1081) at org.apache.axis2.schema.SchemaCompiler.processAnonymousComplexSchemaType(SchemaCompiler.java:980) at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:934) at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:592) at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:563) at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:370) at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:280) at org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:103) ... 8 more 

注意:Apache CXF也失败了:(

我发现只有3个选项可以在Java中用于旧式rpc /编码Web服务:

1)SUN的JAX-RPC参考实现( wscompile

2)WebLogic的clientgen (我使用的是8.1版本)

3)Axis1 v1.4 wsdl2java

最初我们使用了Axis 1.4,它在相对较大的服务响应(> 20k)上表现出相当差的性能,即与没有解析的普通HTTP请求相比,客户端处理时间增加了两倍以上。 如果响应变大,时间会增加。 只需30多秒即可将1MB大容量反序列化。

SUN生成的客户端并没有真正起作用,并且根据请求失败并显示以下消息:

 unexpected element name: expected=getSubscriberInfoReturn, actual={ws.generated.api}getSubscriberInfoReturn 

我尝试过使用WebLogic的8.1 ​​clientgen,并将客户端代码与Axis 1.4生成的客户端性能进行了比较。 而安讯士赢得了比赛。 因此,即使Axis客户端在相对较大的响应上表现不佳,它仍然是旧的rpc /编码Web服务的最佳选择:(。

Axis2不支持RPC编码。 资料来源: http : //wiki.apache.org/ws/StackComparison

尝试Axis 1,我已经将它用于了这个原因。

我在axis2中也遇到过SimpleDataBinding的问题。 我通过使用AxisDataBinding选项解决了它们。 从编码的角度来看,这有点重,但毕竟是有效的。

亚行详细介绍

此外,我同意罗伯特,说明axis1也是一个有趣的选择。

我不打算深入了解这一点,但是因为你要求替代方案:

Java 6 SE和Java 5 EE附带Metro JAX-WS (参考)实现。

它位于javax.xml.ws命名空间中。

Sun的开发人员网络有一篇文章介绍JAX-WS 2.0使用Java SE 6平台可能很有用。

说完这一切之后,Eclipse并不是非常友好的JAX-WS 。

您可以为wsdl2java命令添加以下参数

 -d xmlbeans 

如果soap编码样式是旧的axis2 wsdl2java或者wsimport无法理解旧的RPC编码样式,那么这个问题就会引发因此使用轴1.4或更早版本的轴回退就是你不会找到wsdl2java作为旧轴的工具而不是你将在轴jar文件中找到它作为类文件,因此你必须手动设置类路径并使用该类

D:\ axis-1_4 \ lib> java -classpath \ axis-1_4 \ lib * org.apache.axis.wsdl.WSDL2Java urwsdl