Web services 用Mule中的http:request替换不推荐使用的https:outbound端点
我使用以下配置在mule 3.2中实现了一个基于SOAP的服务,该服务运行良好Web services 用Mule中的http:request替换不推荐使用的https:outbound端点,web-services,soap,mule,cxf,jax-ws,Web Services,Soap,Mule,Cxf,Jax Ws,我使用以下配置在mule 3.2中实现了一个基于SOAP的服务,该服务运行良好 <https:connector name="https" doc:name="HTTP\HTTPS"></https:connector> <https:outbound-endpoint exchange-pattern="request-response" method="POST" address="https://localhost:8080/CXF
<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>
wsdl中的SOAP绑定如下所示:
<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>
在迁移到Mule 3.6时,我将代码替换如下。这样做是为了用http:request替换不推荐使用的https:outbound端点
<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>
但在使用新代码访问服务时,我得到了一个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>
soap:客户端
服务器未识别HTTP标头SOAPAction的值:https://myservice/myEndpoint, "".
可能的原因是什么
仅供参考。我使用的是一个cxf:proxy客户机,其有效负载作为信封,两者都保持不变
<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>
小小的调整创造了奇迹
我在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>
使用旧传输时,该属性可能未映射为HTTP头。能否将代理客户端部分添加到流中?整个过程会更有帮助,但这会有很大帮助。添加了代理客户端部分。已将其添加为消息属性“/>
<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>