如何正确配置mule cxf代理客户端

如何正确配置mule cxf代理客户端,mule,mule-studio,Mule,Mule Studio,嗨,我正在处理一个SOAP请求,我在使用cxf代理客户端时遇到了问题。我基本上是向http端点发送soap请求,移除soap信封,然后尝试将其添加回代理客户端 我希望得到一个不受限制的响应(因为我正在删除wsse头) 但是,我得到以下soap响应:“响应代码500映射为失败。消息负载的类型为:BufferInputStream” 控制台会记录以下内容(注意,这只是它的开始) WARN 2015-05-13 12:38:28886[[sandbox2].HTTP_Listener_Configur

嗨,我正在处理一个SOAP请求,我在使用cxf代理客户端时遇到了问题。我基本上是向http端点发送soap请求,移除soap信封,然后尝试将其添加回代理客户端

我希望得到一个不受限制的响应(因为我正在删除wsse头)

但是,我得到以下soap响应:“响应代码500映射为失败。消息负载的类型为:BufferInputStream” 控制台会记录以下内容(注意,这只是它的开始)

WARN 2015-05-13 12:38:28886[[sandbox2].HTTP_Listener_Configuration.worker.01]org.apache.cxf.phase.PhaseInterceptorChain:{}ProxyService{}invoke的拦截器引发异常,正在解除 org.apache.cxf.interceptor.Fault:响应代码500映射为失败。消息负载的类型为:BufferInputStream 在org.mule.module.cxf.transport.MuleUniversalConduit$2.handleMessage(MuleUniversalConduit.java:194)~[mule-module-cxf-3.6.1.jar:3.6.1] 在org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)~[cxf-api-2.5.9.jar:2.5.9] 在org.apache.cxf.endpoint.clientmpl.doInvoke(clientmpl.java:531)~[cxf-rt-core-2.5.9.jar:2.5.9] 在org.apache.cxf.endpoint.clientmpl.invoke(clientmpl.java:462)~[cxf-rt-core-2.5.9.jar:2.5.9]

这是我的流程

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
    <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8086" doc:name="HTTP Listener Configuration"/>
    <http:request-config name="HTTP_Request_Configuration" host="localhost" port="8080" basePath="my-app/RetrieveAct.svc" doc:name="HTTP Request Configuration"/>
    <flow name="myFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <logger message="message received #[payload] " level="INFO" doc:name="Logger"/>
        <cxf:proxy-service namespace="PfPolicyService"  payload="body" doc:name="CXF"/>
        <logger message="#[payload]" level="INFO" doc:name="Logger"/>
        <logger message="#[payload]" level="INFO" doc:name="Logger"/>
        <cxf:proxy-client payload="body" doc:name="CXF"/>
        <response>
            <logger message="#[payload]" level="INFO" doc:name="Logger"/>
        </response>
        <http:request config-ref="HTTP_Request_Configuration1" path="http://localhost:8080/my-app/RetrieveAct.svc" method="POST" doc:name="HTTP">
            <http:request-builder>
                <http:header headerName="soapAction" value="getUserAcct"/>
            </http:request-builder>
        </http:request>
    </flow>
</mule>

有人能解释一下我做错了什么以及如何纠正这个问题吗


谢谢

您遇到的问题是因为您对SOAP请求的修改最终成为无效的SOAP请求,因此服务器无法对其进行解析,并返回500 http状态代码


您可以使用CXF的日志拦截器来检查发送内容的最终结果。

您的mule流在我看来似乎正常,代理服务可能会因为各种原因而崩溃

将日志拦截器添加到代理客户端,并查看这是否使您能够查明问题:

 <cxf:proxy-client payload="body">
    <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:proxy-client>

或者,使用TPCMon捕获网络流量

在进行集成测试之前,首先设置服务模拟和适当的测试用例将是一个良好的健全性检查