变更讯息名称 [英] Change message name
问题描述
这是我的WSDL的一部分.我正在使用代码优先方法.
Here is the part of my WSDL. I'm using the code first approach.
<portType name="MyWebService">
<operation name="echoString"/>
<input message="echoString"/>
<output message="echoStringResponse"/>
</operation>
</portType>
我应该添加或更改什么注释,以便对此进行更改
What annotation should I add or change so to change this
<input message="echoString"/>
读为
<input message="echoStringRequest"/>
谢谢.
推荐答案
我对自己感到很惊讶,但是尝试了一段时间之后,我才对规范进行了调查,看来您实际上无法在jax-ws中进行此操作(除非在非标准方式,具体取决于实施方式).这是 jax-ws 2.0规范在这个问题上说.请参阅 Java到WSDL 1.1映射,第3.5节,第32页:
I am quite surprised myself, but after trying for a while I looked into the spec and it seems you cannot really do this in jax-ws (except in a non-standard way, depending on the implementation). Here is what the jax-ws 2.0 specification says on this issue. See Java to WSDL 1.1 Mapping, Section 3.5, page 32:
wsdl:message元素的name属性的值不是 重要的,但按照惯例,它通常等于 输入消息的相应操作名称和操作名称 与"Response"串联以输出消息.故障命名 消息在第3.7节中进行了说明.
The value of a wsdl:message element’s name attribute is not significant but by convention it is normally equal to the corresponding operation name for input messages and the operation name concatenated with "Response" for output messages. Naming of fault messages is described in section section 3.7.
因此,我想到的唯一选择就是重命名您的操作,例如通过更改或添加@WebMethod
批注.这是一个示例:
So the only option that comes to my mind is to rename your operation, for example by changing or adding a @WebMethod
annotation. Here is an example:
@WebMethod(operationName = "echoStringRequest")
public String echoString(String echoStringRequest) {
return echoStringRequest;
}
这将生成以下portType
:
<portType name="MyWebService">
<operation name="echoStringRequest">
<input message="tns:echoStringRequest"></input>
<output message="tns:echoStringRequestResponse"></output>
</operation>
</portType>
是否对这个版本感到满意取决于您自己.
The decision of whether you are more happy with this version is up to you.
这篇关于变更讯息名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!