2013-04-23 80 views
1

中迷路了我正在测试我的Mule(3.3.1)流向外部供应商发送Web服务调用。我的目标是赶上 java.net.ConnectException并将适当的 XSLT应用于原始有效负载并发送给调用者。 为什么Mule有效负载在java.net.ConnectException

但是在<catch-exception-strategy>中收到的有效载荷的类型为[email protected]而非原始的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> 

回答

3
  • 存储原始净荷流量变量权jms:inbound-endpoint

    <set-variable variableName="originalPayload" value="#[message.payload]" /> 
    
  • 访问回来与MEL您的例外策略表达式如下:#[flowVars.originalPayload]

+0

是的,这是一个好主意。但为什么有效载荷会丢失。我读到Mule(3.3以上)在抛出异常时保留了原始有效负载,并且没有用异常有效负载替换它 – 2013-04-23 17:18:50

+0

并且情况如此:您看到的负载不是异常负载(位于名为“exception”的属性中) ),但是有效负载是在发生故障时已准备好由“出站端点”发送的。 – 2013-04-23 17:20:14

+0

我明白了,是的,事实就是如此。但是没有办法从准备发送的有效载荷中提取xml – 2013-04-23 17:24:37