簡體   English   中英

wsimport創建的類產生的wsdl與源wsdl不同

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

我正在嘗試使用wsimport(或更准確地說,我正在使用使用wsimport的eclipse向導)為Web服務生成新的服務器端類。 WSDL源通過../ServiceName?wsdl URL來自當前實現。

我的問題是,當我發布新類並導航到新的?wsdl URL時,結果WSDL與原始結果不同。 當現有客戶端嘗試使用新版本的服務時,這似乎是導致錯誤的原因。 這是WSDL的一個小節,其中包含一個差異示例,該差異似乎導致客戶端出現問題:

原版的:

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

新:

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

更改在portType輸入消息中。 它從“ executeRequest”重命名為“ execute”。

我不知道為什么會改變或如何在Java類中更正它。 所有注釋似乎都是正確的。

似乎缺少的“請求”后綴是功能而不是CXF的錯誤。 我需要做的是更新我的客戶端或實現服務器端攔截器:

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

這個:

您將需要子類org.apache.cxf.service.factory.DefaultServiceConfiguration並重寫getInputMessageName方法,以將QName附加“ Request”。 然后,您將必須配置CXF以將服務配置指向您的子類

如果我能弄清楚該怎么做,這似乎也是一個不錯的解決方案。 https://stackoverflow.com/questions/27818072/subclassing-defaultserviceconfiguration

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM