【问题标题】:How to configure mule cxf proxy client correctly如何正确配置mule cxf代理客户端
【发布时间】:2015-05-13 00:49:28
【问题描述】:

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

我希望得到未经授权的响应(因为我正在删除 wsse 标头)。

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

WARN 2015-05-13 12:38:28,886 [[sandbox2].HTTP_Listener_Configuration.worker.01] org.apache.cxf.phase.PhaseInterceptorChain:拦截器用于 {http://support.cxf.module.mule.org/}ProxyService#{http://support.cxf.module.mule.org/}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.ClientImpl.doInvoke(ClientImpl.java:531) ~[cxf-rt-core-2.5.9.jar:2.5.9] 在 org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.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>

谁能解释我做错了什么以及如何纠正这个问题?

谢谢

【问题讨论】:

    标签: mule mule-studio


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      您的 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 捕获网络流量。

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-03-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多