【发布时间】:2013-10-24 21:27:51
【问题描述】:
如何使用 Mule 3.3.1 记录原始 SOAP 异常响应?当我在流程末尾添加<exception-strategy ref="myStrategy"/> 以及定义如下的myStrategy 时:
<choice-exception-strategy name="myStrategy">
<catch-exception-strategy when="exception.causedBy(com.example.ServiceException)">
<logger message="Caught a service exception" level="INFO" />
<!-- <logger message="what to put here to get SOAP response?" level="INFO"/> -->
</catch-exception-strategy>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
</choice-exception-strategy>
我希望能够输出原始 SOAP 响应。
消息负载似乎是payload=org.apache.commons.httpclient.methods.PostMethod 类型。我可以在OUTBOUND scoped properties 中看到 SOAP 调用详细信息。
流程的相关部分如下所示:
<https:outbound-endpoint exchange-pattern="request-response" host="hostAddress" port="portNumber" path="path/to/service" doc:name="HTTP" connector-ref="connector" responseTimeout="50000" >
<cxf:jaxws-client clientClass="com.example.Service"
enableMuleSoapHeaders="true" doc:name="SOAP" operation="methodName"
port="PortName"
wsdlLocation="wsdl/wsdlName.wsdl">
</cxf:jaxws-client>
</https:outbound-endpoint>
<exception-strategy ref="myStrategy" doc:name="Reference Exception Strategy"/>
【问题讨论】:
-
您是否收到来自您正在进行的出站呼叫的 SOAP 错误?还是你想捕获异常并给出 SOAP 错误?
-
我想记录来自服务的原始响应。我相信我得到了合适的
com.example.ServiceException。 -
当您从正在调用的服务收到异常时,不会记录任何响应。 paylaod 包含从您的流程发送的发布请求。如果要返回一个 SOAP 错误,那么它应该由您在基于异常的异常策略中准备好。
-
如果 SOAP 错误作为您从流程中调用的服务的响应接收到,那么它不会进入异常策略。