为什么Mule有效负载在java.net.ConnectException的<catch-exception-strategy>中丢失</catch-exception-strategy>

时间:2013-04-23 15:38:17

标签: mule

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

<catch-exception-strategy>中收到的有效负载属于org.apache.commons.httpclient.methods.PostMethod@12b13004类型而非原始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> 

1 个答案:

答案 0 :(得分:3)

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

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