2015-12-02 124 views
0

我打了最後兩天有同樣的問題,我不知道如何解決這個問題。甚至不知道這是否是錯誤。CXF不正確的WSDL自動生成?

我有一個CXF Web服務,我覺得很奇怪,我想修復。這是一個調用的Web服務涉及:

@WebResult (name="merchantHierarchyParentResponse") MerchantHierarchyParentResponseDTO 
getParent(
     @WebParam(name="institutionNumber") @XmlElement(required=true) String institutionNumber, 
     @WebParam(name="clientNumber") String clientNumber, 
     @WebParam(name="ourReference") String ourReference, 
     @WebParam(name="accessMerch") String accessMerch, 
     @WebParam(header=true, name="callerId") String callerId, 
     @WebParam(header=true, name="timestamp") String timestamp, 
     @WebParam(header=true, name="signature") String signature 
); 

正如你所看到的,它接收4個正常參數加在頭3個額外的參數(來電顯示,時間戳和簽名)。

它編譯成功。然後,我也將它成功部署到WebLogic服務器中。

最後,我使用SoapUI來測試它。我向SoapUI提供了WebLogic爲我提供WSDL的URL。這是,我沒有在自動生成的WSDL中進行任何更改。這是我得到這個getParent在SoupUI:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webService.webservice.omnipay.com.server/"> 
    <soapenv:Header> 
     <web:signature>?</web:signature> 
     <web:timestamp>?</web:timestamp> 
     <web:callerId>?</web:callerId> 
    </soapenv:Header> 
    <soapenv:Body> 
     <web:getParent> 
     <institutionNumber>?</institutionNumber> 
     <!--Optional:--> 
     <clientNumber>?</clientNumber> 
     <!--Optional:--> 
     <ourReference>?</ourReference> 
     <!--Optional:--> 
     <accessMerch>?</accessMerch> 
     </web:getParent> 
     <web:callerId>?</web:callerId> 
     <web:timestamp>?</web:timestamp> 
     <web:signature>?</web:signature> 
    </soapenv:Body> 
</soapenv:Envelope> 

我的問題是非常清楚。我在標題部分(callerId,timestamp和signature)中看到3個參數,但爲什麼這3個參數在主體部分的末尾仍然是AGAIN。我不希望他們在身體部位,我只希望他們在頭部。

任何想法爲什麼會發生這種情況?這是一個錯誤嗎?

+0

請將您的評論複製到此問題的答案,並在此問題修復後予以批准。因此,這個問題不會在系統中顯示出未答覆的廣告。 –

回答

0

嗨,感謝幫助我解決問題的人。

這裏的WSDL的部分:綁定與使用getParent調用相關:

<wsdl:binding name="ServiceImplServiceSoapBinding" type="tns:IService"> 
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <wsdl:operation name="getParent"> 
     <soap:operation soapAction="" style="document"/> 
     <wsdl:input name="getParent"> 
      <soap:header encodingStyle="" message="tns:getParent" part="callerId" use="literal"/> 
      <soap:header encodingStyle="" message="tns:getParent" part="timestamp" use="literal"/> 
      <soap:header encodingStyle="" message="tns:getParent" part="signature" use="literal"/> 
      <soap:body use="literal"/> 
     </wsdl:input> 
     <wsdl:output name="getParentResponse"> 
      <soap:body use="literal"/> 
     </wsdl:output> 
</wsdl:operation> 

我曾在部分改變,這條線

<soap:body use="literal"/> 

這一個

<soap:body use="literal" parts="parameters"/> 

不太確定爲什麼這個零件屬性不是在我自動生成的WSDL中生成的,但是,它修復編輯我的問題。我不想在wsdl中進行此手動更改。無論如何,至少我的問題是固定的。