2015-10-14 84 views
2

我用以下配置打在骡3.2基于SOAP的服务,它工作得很好更换弃用的https:出站端点以http:请求在骡

<https:connector name="https" doc:name="HTTP\HTTPS"></https:connector> 

<https:outbound-endpoint exchange-pattern="request-response" method="POST" 
      address="https://localhost:8080/CXF3Service/test" responseTimeout="15000" contentType="application/xml" 
      doc:name="HTTP Submit Request SOAP" connector-ref="https"> <message-properties-transformer 
      scope="outbound"> <add-message-property key="SOAPAction" value="https://myservice/myEndpoint" 
      /> </message-properties-transformer> </https:outbound-endpoint> 

enter image description here

SOAP绑定在wsdl看起来像,

<wsdl:operation name="sayHello"> 
<soap:operation soapAction="https://myservice/myEndpoint" style="document"/> 
<wsdl:input name="sayHello"> 
<soap:body use="literal"/> 
</wsdl:input> 
<wsdl:output name="sayHelloResponse"> 
<soap:body use="literal"/> 
</wsdl:output> 
</wsdl:operation> 

在迁移到骡3.6,我替换代码如下。这样做是为了取代已过时的HTTPS:以http出站终点:要求

<http:request-config name="http" protocol="HTTPS" 
     host="localhost" port="8080" 
     doc:name="HTTP Request Configuration"/> 

<http:request config-ref="http" path="CXF3Service/test" method="POST" 
      doc:name="HTTP" responseTimeout="15000" > 
      <http:request-builder> 
       <http:header headerName="SOAPAction" value="https://myservice/myEndpoint" ></http:header> 
      </http:request-builder>   
      <http:success-status-code-validator 
       values="0..599" /> 
     </http:request> 

enter image description here

但在击中新代码的服务,我得到一个SOAP错误作为响应。

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body> 
    <soap:Fault> 
     <faultcode>soap:Client</faultcode> 
     <faultstring>Server did not recognize the value of HTTP Header SOAPAction: https://myservice/myEndpoint, "".</faultstring> 
     <detail/> 
    </soap:Fault> 
    </soap:Body> 
</soap:Envelope> 

这可能是什么原因造成的?

仅供参考。我正在使用一个cxf:代理客户端与有效载荷作为信封,这两个保持不变。

<cxf:proxy-client payload="envelope" doc:name="Proxy client"> 
    <cxf:inInterceptors> 
     <spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor"> 
      <spring:property name="prettyLogging" value="true" /> 
     </spring:bean> 
    </cxf:inInterceptors> 
    <cxf:outInterceptors> 
     <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"> 
      <spring:property name="prettyLogging" value="true" /> 
     </spring:bean> 
    </cxf:outInterceptors> 
    <cxf:outFaultInterceptors> 
     <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"> 
      <spring:property name="prettyLogging" value="true" /> 
     </spring:bean> 
    </cxf:outFaultInterceptors> 
</cxf:proxy-client> 
+0

的属性使用旧运输时很可能不能映射为一个HTTP标头。你可以添加流的代理客户端部分?整个事情会更有帮助,但这会有很大帮助。代理客户端部分已添加 – afelisatti

+0

。它被添加为消息属性 Renjith

回答

1

小调整做了魔术!

我在http:request之前设置了SOAPAction,而不是在里面设置它。

<cxf:proxy-client payload="envelope" doc:name="Proxy client"> 
<cxf:inInterceptors> 
    <spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor"> 
     <spring:property name="prettyLogging" value="true" /> 
    </spring:bean> 
</cxf:inInterceptors> 
<cxf:outInterceptors> 
    <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"> 
     <spring:property name="prettyLogging" value="true" /> 
    </spring:bean> 
</cxf:outInterceptors> 
<cxf:outFaultInterceptors> 
    <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"> 
     <spring:property name="prettyLogging" value="true" /> 
    </spring:bean> 
</cxf:outFaultInterceptors> 
</cxf:proxy-client> 
<message-properties-transformer> 
     <add-message-property key="SOAPAction" value="https://myservice/myEndpoint"/> 
    </message-properties-transformer> 
<http:request config-ref="http" path="CXF3Service/test" method="POST" 
     doc:name="HTTP" responseTimeout="15000" >   
     <http:success-status-code-validator 
      values="0..599" /> 
    </http:request>