从 WSDL 生成类:带有名称错误的重复操作 [英] Generating classes from WSDL: Duplicate operation with name error

查看:27
本文介绍了从 WSDL 生成类:带有名称错误的重复操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Eclipse 抛出此异常:

从 WSDL 生成 Java 时出错:java.lang.IllegalArgumentException:在端口类型{http://tempuri.org/}MyServiceSoap"中找到名称=OpName 的重复操作.

在 WSDL 中:

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

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

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

解决方案

这是操作重载的情况.这仅在 WSDL1.1 规范中受支持.根据新的 WSDL1.2 规范,不允许操作重载.您将不得不更改操作的名称.

查看此链接

引用此链接.

<块引用>

这里需要注意的是,支持重载操作在 WSDL 1.1 中(请参阅下面资源"部分中的链接),但有已从 WSDL 1.2 的规范草案中删除.委员会制定新草案已决定不应超载展示.做出这一决定的理由和意见超出了本文的范围,但有关于它的参考说明WSDL 1.2 的当前工作草案

所以只是为了让它工作,改变操作的名称,或者如果你正在生成一个客户端,检查 eclipse 是否提供了一些选择 WSDL 版本的选项.

I am trying to generate Java classes using Eclipse (New Web Service Client).

Eclipse throws this exception:

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

In 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>

How can I solve this issue? Could you suggest any other tools or development environments to generate classes according to WSDL?

解决方案

This is the case of Operation Overloading. This was only supported in WSDL1.1 specification. As per the new WSDL1.2 Specs, Operation Overloading is not allowed. You will have to change the name of the operation.

Check out this link

To quote from 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

So just to make it work, change the name of the operation or if you are generating a client, check if the eclipse provides some option to select the WSDL version.

这篇关于从 WSDL 生成类:带有名称错误的重复操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆