简体   繁体   English

wsimport创建的类产生的wsdl与源wsdl不同

[英]wsimport creates classes that produce a wsdl that is different from the source wsdl

I'm trying to use wsimport (or more accurately I'm using the eclipse wizard that uses wsimport) to generate new server side classes for a webservice. 我正在尝试使用wsimport(或更准确地说,我正在使用使用wsimport的eclipse向导)为Web服务生成新的服务器端类。 The source WSDL comes from the current implementation via the ../ServiceName?wsdl URL. WSDL源通过../ServiceName?wsdl URL来自当前实现。

My problem is that when I publish the new classes and navigate to the new ?wsdl URL the results WSDL is different than the original. 我的问题是,当我发布新类并导航到新的?wsdl URL时,结果WSDL与原始结果不同。 This seems to be a cause of errors when the existing clients try to use the new version of the service. 当现有客户端尝试使用新版本的服务时,这似乎是导致错误的原因。 Here is a subsection of the WSDL with an example of a difference that seems to cause a problem with the clients: 这是WSDL的一个小节,其中包含一个差异示例,该差异似乎导致客户端出现问题:

Original: 原版的:

<wsdl:message name="executeResponse">
  <wsdl:part element="impl:ServiceNameResult" name="ServiceNameResult"/>
</wsdl:message>
<wsdl:message name="executeRequest">
  <wsdl:part element="impl:executeRequest" name="executeRequest"/>
</wsdl:message>
<wsdl:portType name="ServiceName">
  <wsdl:operation name="execute" parameterOrder="executeRequest">
    <wsdl:input message="impl:executeRequest" name="executeRequest"/>
    <wsdl:output message="impl:executeResponse" name="executeResponse"/>
  </wsdl:operation>
</wsdl:portType>

New: 新:

<wsdl:message name="executeResponse">
    <wsdl:part element="tns:ServiceNameResult" name="ServiceNameResult">
    </wsdl:part>
</wsdl:message>
<wsdl:message name="execute">
    <wsdl:part element="tns:executeRequest" name="executeRequest">
  </wsdl:part>
</wsdl:message>
<wsdl:portType name="ServiceName">
    <wsdl:operation name="execute">
    <wsdl:input message="tns:execute" name="execute">
    </wsdl:input>
    <wsdl:output message="tns:executeResponse" name="executeResponse">
    </wsdl:output>
  </wsdl:operation>
</wsdl:portType>

The change is in the portType input message. 更改在portType输入消息中。 It gets renamed from "executeRequest" to simply "execute". 它从“ executeRequest”重命名为“ execute”。

I can't figure out why this would change or how to correct it in the java classes. 我不知道为什么会改变或如何在Java类中更正它。 All the annotations seem correct. 所有注释似乎都是正确的。

It seems like the missing "Request" suffix is a feature and not a bug of CXF. 似乎缺少的“请求”后缀是功能而不是CXF的错误。 What I need to do is either update my clients or implement serverside interceptors: 我需要做的是更新我的客户端或实现服务器端拦截器:

http://cxf.apache.org/docs/interceptors.html http://cxf.apache.org/docs/interceptors.html

This: 这个:

You will need to subclass org.apache.cxf.service.factory.DefaultServiceConfiguration and override getInputMessageName method to append the QName with "Request". 您将需要子类org.apache.cxf.service.factory.DefaultServiceConfiguration并重写getInputMessageName方法,以将QName附加“ Request”。 Then, you will have to configure CXF to point the service configuration to your subclass 然后,您将必须配置CXF以将服务配置指向您的子类

Also seems like a good solution if I can figure out how to do it. 如果我能弄清楚该怎么做,这似乎也是一个不错的解决方案。 https://stackoverflow.com/questions/27818072/subclassing-defaultserviceconfiguration https://stackoverflow.com/questions/27818072/subclassing-defaultserviceconfiguration

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

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