简体   繁体   English

使用Jaxb绑定更改零件名称

[英]Change part name with Jaxb binding

I have a WSDL like that : 我有这样的WSDL:

...
<wsdl:message name="myHeader">
    <wsdl:part name="parameter" element="header:myHeader"/>
</wsdl:message>
...
<wsdl:operation name="myOperation">
   <soap:operation soapAction="myOperation" style="document" />
   <wsdl:input name="myOperationRequest">
    <soap:header message="mySession:myHeader" part="header" use="literal"/>
       <soap:body parts="parameters" use="literal" />
   </wsdl:input>
   <wsdl:output name="myOperationResponse">
       <soap:body parts="parameters" use="literal" />
   </wsdl:output>
   <wsdl:fault name="myOperationException">
       <soap:fault name="createTroubleTicketByValueException" use="literal" />
   </wsdl:fault>
</wsdl:operation>
....

I convert my WSDL into Java with wsdl2java, not problem during the conversion with the exsh set to true. 我使用wsdl2java将WSDL转换为Java,在exsh设置为true的转换过程中没有问题。 But when I start my application (Spring 4, CXF 2.7), I'm getting the following warning : 但是,当我启动应用程序(Spring 4,CXF 2.7)时,收到以下警告:

2015-09-28 14:19:04,640 WARN [main] oacsfReflectionServiceFactoryBean(1525) - Method interface ....XXXSessionWSPort.myOperation is configured as BARE but there are more than one parameters with wrong @Webparam annotated or without @WebParam annotated. 2015-09-28 14:19:04,640警告[main] oacsfReflectionServiceFactoryBean(1525)-方法接口.... XXXSessionWSPort.myOperation被配置为BARE,但有多个参数带有错误的@Webparam注释或没有@WebParam的注释。

If I look closer to the WsPort generated : 如果我更靠近生成的WsPort:

@WebResult(name = "myOperationResponse", targetNamespace = "http://myNamespace", partName = "parameters")
@WebMethod(action = "myOperation")
public myOperationResponse myOperation(
    @WebParam(partName = "parameters", name = "myOperationRequest", targetNamespace = "http://myNameSpace")
    myOperationRequest parameters,
    @WebParam(partName = "parameters", name = "myheader", targetNamespace = "http://headerNameSpace", header = true)
    myHeader parameters1) throws myOperationException;

Moreover, as a client when I make a call to myOperation CXF/JAXB/Jax-ws/...(?) add a "1" at the end of the myHeader tag, consequently the server cannot handle the header... 此外,作为客户端,当我调用myOperation CXF / JAXB / Jax-ws / ...(?)时,在myHeader标记的末尾添加“ 1”,因此服务器无法处理标头...

After debugging in the class ReflectionServiceFactoryBean, I see the problem coming from the same partName in the two @WebParam. 在类ReflectionServiceFactoryBean中进行调试后,我看到问题来自两个@WebParam中的相同partName。

To correct this, I have to change the header's part name into the WSDL, but I can't : it's not mine. 要纠正此问题,我必须将标题的部件名称更改为WSDL,但我不能:这不是我的。

So I would made this change in the jaxb binding xml file, if possible, how can I do that? 因此,如果可能的话,我将在jaxb绑定xml文件中进行此更改,我该怎么做?

If you have a better solution don't hesitate! 如果您有更好的解决方案,请不要犹豫!

A bit late, but maybe this can help you: "A customization file" 有点晚了,但这也许可以帮助您:“自定义文件”

http://java-soa.blogspot.pe/2008/07/parameter-customization-in-jax-ws.html http://java-soa.blogspot.pe/2008/07/parameter-customization-in-jax-ws.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM