1

我正在测试我的 Mule(3.3.1) 流,该流向外部供应商发送 Web 服务调用。我的目标是捕获java.net.ConnectException并应用于XSLT原始有效负载并将其发送给调用者。

但是收到的有效载荷<catch-exception-strategy>是 typeorg.apache.commons.httpclient.methods.PostMethod@12b13004而不是 original XML。尝试使用<objexct-to-string-transformer>但没有帮助。

任何建议如何检索catch块中的原始有效负载?

部分mule-config.xml如下:

    <flow name="orderRequirementsToVendor">
        <jms:inbound-endpoint queue="order.vendor" />   

        <set-property propertyName="SOAPAction" value="http://vendor.com/services/InterfacePoint/Call" /> 

        <cxf:proxy-client payload="body" enableMuleSoapHeaders="false">
            <cxf:inInterceptors>
                <spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />                  
            </cxf:inInterceptors>
            <cxf:outInterceptors>
                <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
            </cxf:outInterceptors>
        </cxf:proxy-client>
        <outbound-endpoint address="${vendor.ws.url}" mimeType="text/xml" connector-ref="https.connector" />
        <byte-array-to-string-transformer />

         <choice-exception-strategy>
            <catch-exception-strategy when="#[exception.causedBy(java.net.ConnectException)]">
                <logger message="#[exception.causeException]" level="ERROR" />
                <object-to-string-transformer/>
                <transformer ref="vendorConnectExceptionTransformer" />
             </catch-exception-strategy>
            <catch-exception-strategy>
                <logger message="#[exception.causeException]" level="ERROR" />
                <transformer ref="generalErrorTransformer" />
            </catch-exception-strategy>
        </choice-exception-strategy> 

    </flow> 
4

1 回答 1

3
  • jms:inbound-endpoint在with之后将原始有效负载存储在流变量中

    <set-variable variableName="originalPayload" value="#[message.payload]" />
    
  • 使用 MEL 表达式在您的异常策略中访问它,例如:#[flowVars.originalPayload]

于 2013-04-23T17:03:46.380 回答