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

发布于 2024-08-03 15:10:14 字数 3800 浏览 4 评论 0原文

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 也失败:(

Is there any alternative to Axis2? Or the way to make it work (different data binding, for example)?

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

NOTE: Apache CXF fails as well :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

鱼窥荷 2024-08-10 15:10:14

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

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

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

3) Axis1 v1.4 wsdl2java

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

SUN 生成的客户端并没有真正工作,并且在请求时失败并显示以下消息:

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

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

There are only 3 options that I have found that can be used in Java for old-style rpc/encoded web services:

1) SUN's reference implementation of JAX-RPC (wscompile)

2) WebLogic's clientgen (I used 8.1 version)

3) Axis1 v1.4 wsdl2java

Originally we used Axis 1.4 for that and it showed quite poor performance on relatively large service responses (>20k) i.e. client processing time increased more than twice comparing to plain HTTP request without parsing. And the time grows if response gets bigger. It took more than 30s to just deserialize 1MB large respose.

SUN's generated client didn't really work and it failed on request with the message:

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

I have tried using WebLogic's 8.1 clientgen, and compared client code to Axis 1.4 generated client's performance. And Axis won the race. So, even though Axis client is performing not that good on relatively large responses it still is the best option out there for old rpc/encoded web services :(.

¢好甜 2024-08-10 15:10:14

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

RPC encoding is not supported on Axis2. Source: http://wiki.apache.org/ws/StackComparison

2024-08-10 15:10:14

尝试使用 Axis 1,我就是因为这个原因才使用它的。

Try Axis 1, I've used it for this exact reason.

差↓一点笑了 2024-08-10 15:10:14

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

ADB 详细信息

此外,我同意 Robert 的观点,指出axis1 也是一个有趣的选择。

I've had issues with SimpleDataBinding in axis2 too. I resolved them by using the
AxisDataBinding option. Which is bit more heavy weight from a coding perspective,
but works after all.

ADB in detail

Furthermore I'd agree to Robert, stating that axis1 is an interesting option too.

输什么也不输骨气 2024-08-10 15:10:14

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

-d xmlbeans

You can add following parameter for wsdl2java command

-d xmlbeans
倥絔 2024-08-10 15:10:14

我不打算深入讨论这一点,但既然您要求替代方案:

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

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

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

话虽如此,Eclipse 并不是非常JAX-WS 友好

I'm not going to get in depth with this, but since you asked for alternatives:

Java 6 SE and Java 5 EE ship with the Metro JAX-WS (reference) implementation.

It lives in the javax.xml.ws namespace.

Sun's Developer Network has an article Introducing JAX-WS 2.0 With the Java SE 6 Platform that might be useful.

Having said all this, Eclipse is not very JAX-WS friendly.

陈年往事 2024-08-10 15:10:14

如果肥皂编码风格旧,则会出现此问题
axis2 wsdl2java或wsimport无法理解旧的RPC编码风格
所以使用axis 1.4或更旧版本的axis
缺点是你在旧轴中找不到 wsdl2java 作为工具
相反,您会在轴 jar 文件中找到它作为类文件
所以你必须手动设置类路径并使用该类

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

This issue raises if the soap encoding style is old
axis2 wsdl2java or wsimport cannot understand the old RPC encoding style
so use the axis 1.4 or older version of axis
the draw back is that u will not find wsdl2java as a tool in old axis
instead you will find it as a class file in the axis jar file
so u have to manually set a the classpath and use that class

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

万劫不复 2024-08-10 15:10:14

在这里找到了有关soapenc.xsd的答案
Clickatell SOAP wsdl 到 JAXB java 类
帮助了我。

我正在使用 axis1.5 的 wsdl2java 实用程序,我们在数组上遇到了类似的错误。

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)

我尝试通过使用网站 'http://schemas 中的内容创建soapenc.xsd 来更新我的 wsdl 文件.xmlsoap.org/soap/encoding/'。
如下所示,这对我来说确实有效。

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1= .. xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns=.. xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace=..>
<types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace=.. xmlns:ns1=.. xmlns:ns2=.. xmlns:tns=.. xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
</types>
<import location="soapenc.xsd" namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<message name="Input">
    <part name=../>
</message>
<message name="Output">
    <part name=../>
</message>
<portType name=".."> .. </portType>
<binding name="..." type="tns:"..">
    <operation name="...">          ..          </operation>
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
</binding>
<service name="...">
    <port binding="tns:..." name="...">         <soap:address location="..."/>      </port>
</service>

The answer post on soapenc.xsd found here
Clickatell SOAP wsdl to JAXB java classes
helped me .

I was using wsdl2java utility of axis1.5, we got the similar error on array.

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)

I tried updating my wsdl file by creating the soapenc.xsd with the contents from website 'http://schemas.xmlsoap.org/soap/encoding/'.
As shown below, this worked really for me.

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1= .. xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns=.. xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace=..>
<types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace=.. xmlns:ns1=.. xmlns:ns2=.. xmlns:tns=.. xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
</types>
<import location="soapenc.xsd" namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<message name="Input">
    <part name=../>
</message>
<message name="Output">
    <part name=../>
</message>
<portType name=".."> .. </portType>
<binding name="..." type="tns:"..">
    <operation name="...">          ..          </operation>
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
</binding>
<service name="...">
    <port binding="tns:..." name="...">         <soap:address location="..."/>      </port>
</service>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文