java - 从 WSDL 生成类 : Duplicate operation with name error

标签 java android web-services wsdl

我正在尝试使用 Eclipse(新 Web 服务客户端)生成 Java 类。

Eclipse 抛出此异常:

Error in generating Java from WSDL: java.lang.IllegalArgumentException: Duplicate operation with name=OpName, found in portType '{http://tempuri.org/}MyServiceSoap'.

在 WSDL 中:

<wsdl:operation name="OpName"> <wsdl:input message="tns:tnsIn"/> <wsdl:output message="tns:tnsOut"/> </wsdl:operation>

<wsdl:operation name="OpName"> <wsdl:input name="name" message="tns:tnsIn"/><wsdl:output name="name" message="tns:tnsOut"/></wsdl:operation>

如何解决这个问题?您能否推荐任何其他工具或开发环境来根据 WSDL 生成类?

最佳答案

这就是操作重载的情况。仅 WSDL1.1 规范支持此功能。根据新的 WSDL1.2 规范,不允许操作重载。您必须更改操作的名称。

查看this link

引用此链接。

It is important to note here that overloaded operations are supported in WSDL 1.1 (see the links in the "Resources" section below),but have been removed from the draft specification for WSDL 1.2. The committee developing the new draft has decided that overloading should not be present. The reasons and opinions for this decision are outside the scope of this article, but there are reference notes regarding it in the current working draft for WSDL 1.2

因此,为了使其正常工作,请更改操作的名称,或者如果您要生成客户端,请检查 eclipse 是否提供了一些选项来选择 WSDL 版本。

关于java - 从 WSDL 生成类 : Duplicate operation with name error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8270765/

相关文章:

Android - 来自服务的通知栏高度

java - SAX 解析异常 : XML document structures must start and end within the same entity

java - 包含总是返回 false

android - 在 Android 上调用双号电话号码的快捷方式

java - 是3DES = DES 做3次吗?

android - fragment 中的 overridePendingTransition

php - 在android中使用okhttp将数组或jsonobject传递给php url?

java - Mock Mule JavaComponent

Java - 将多个用户输入添加到 arraylist

java - Java监听ARP广播