gpt4 book ai didi

java - 使用 apache cxf 从 wsdl 生成客户端时出错

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:42:52 24 4
gpt4 key购买 nike

我尝试通过以下命令使用 cxf(版本 2.2.3、2.2.6 和 2.7.0)从 wsdl 生成 stub 和客户端

> wsdl2java.bat -p com.easynet.eordering.client -client  http://expediter.staging.gis.easynet.com:7001/cds/services/eordering?wsdl

但是我得到了一个错误

WSDLToJava Error: Non unique body parts! In a port, operations must have unique operation signaure on the wire for successful dispatch. In port {http://eordering.uk.easynet.net}eorderingPortSOAP, Operations "{http://eordering.uk.easynet.net}getAMList" and "{http://eordering.uk.easynet.net}getDCList" have the same request body block {http://eordering.uk.easynet.net}userListRequest

我知道为什么会抛出这个错误,在我的wsdl操作中写成

<operation name="getDCList"><input message="tns:userListRequest"/><output message="tns:userListResponse"/></operation>
<operation name="getAMList"><input message="tns:userListRequest"/><output message="tns:userListResponse"/></operation>

我只是为这两个操作重用了 userListRequest 参数,我相信抛出错误是因为在两个操作中指定了相同的参数 (userListRequest)。

有没有办法在不更改 wsdl 的情况下避免此错误? (据我所知,wsdl 1.2 不允许操作重载,但输入参数重载?)。

最佳答案

如题中所述:

Is there any way to avoid this error without making changes to the wsdl ?

如果您无法修复 WSDL,则可以禁用其验证:

-验证=无

或者如果您使用的是 Maven:

<configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/wsdl/my.wsdl</wsdl>
<validate>none</validate>
</wsdlOption>
</wsdlOptions>
</configuration>

不确定这是否会在运行时引起问题。我会很快找到它并更新这篇文章。

关于java - 使用 apache cxf 从 wsdl 生成客户端时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13029088/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com