2015-12-02 64 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中进行此手动更改。无论如何,至少我的问题是固定的。