我有一个mule服务,其中包含代理服务和客户端。当我向客户端发出请求时它会抛出一些异常。虽然抛出异常,它发送一个soap fault xml,其中包含我需要的详细信息标记在响应中显示它。我在soap客户端使用inInterceptor来访问错误,使用的类是CheckFaultInterceptor。 目前我只能从soap client访问故障字符串。但我的要求是访问整个soap fault xml。请帮助我。 我的mule configuration.xml是:
<context:property-placeholder location="SrvcReq_Gtwy.properties" />
<spring:beans>
<spring:bean id="CreateSRFaultInterceptor" name="CreateSRFaultInterceptor"
class="org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor" />
</spring:beans>
<message-properties-transformer name="AddSoapActionHeader"
overwrite="true" doc:name="Message Properties">
<add-message-property key="SOAPAction"
value=""document/http://siebel.com/CustomUI:CreateSR1"" />
</message-properties-transformer>
<mulexml:namespace-manager
includeConfigNamespaces="true">
<mulexml:namespace prefix="srv"
uri="http://bac.com/wsdl/CIPT/20130923/SrvcRqstMsg" />
<mulexml:namespace prefix="srv1"
uri="http://bac.com/xsd/CIPT/20130923/SrvcRqstMsg" />
</mulexml:namespace-manager>
<flow name="CreateSrvcReqFlow" doc:name="CreateSrvcReqFlow">
<vm:inbound-endpoint exchange-pattern="request-response"
path="vm:CreateSrvcReq" doc:name="ReceiveMsgForCreateSR" />
<component
class="com.bac.gwb.credit.servicerequest.transformers.CreateServiceRequestIntializer"
doc:name="InitializeVariables" />
<data-mapper:transform config-ref="PojoToGSSReq_grf"
doc:name="PojoToGSSReq" />
<byte-array-to-string-transformer
doc:name="Byte Array to String" />
<logger level="INFO" doc:name="Logger"
message="ArchivedInvoice Message Payload after transformation is #[message.payload]" />
<object-to-string-transformer doc:name="Object to String" />
<flow-ref name="CreateSrvcReqGSSInvocation" doc:name="CreateSRInvocation" />
<mulexml:dom-to-xml-transformer
returnClass="java.lang.String" doc:name="DOM to XML"></mulexml:dom-to-xml-transformer>
<logger message="GSS - Response MSG #[message.payload]" level="INFO"
doc:name="Logger" />
<byte-array-to-string-transformer
doc:name="Byte Array to String" />
<logger level="INFO" doc:name="Logger" />
<choice-exception-strategy doc:name="Choice_Exception_Strategy1">
<catch-exception-strategy
when="#[exception.causedBy(java.net.SocketTimeoutException)]"
doc:name="Catch Exception Strategy">
<processor-chain doc:name="Processor Chain">
<logger message="Exception is - #[exception] " level="INFO"
doc:name="Logger" />
<data-mapper:transform config-ref="pojo_to_json"
doc:name="CreateSoapFaultDM">
<data-mapper:input-arguments>
<data-mapper:input-argument key="CreateSoapFault">#[exception]
</data-mapper:input-argument>
</data-mapper:input-arguments>
</data-mapper:transform>
<byte-array-to-string-transformer
doc:name="Byte Array to String" />
</processor-chain>
</catch-exception-strategy>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<processor-chain doc:name="Processor Chain">
<logger message="Exception is Other - #[exception] " level="INFO"
doc:name="Logger" />
<data-mapper:transform config-ref="createsoapfaultotherdm_grf"
doc:name="DataMapper">
<data-mapper:input-arguments>
<data-mapper:input-argument key="CreateSoapFaultException">#[exception]
</data-mapper:input-argument>
</data-mapper:input-arguments>
</data-mapper:transform>
<byte-array-to-string-transformer
doc:name="Byte Array to String" />
</processor-chain>
</catch-exception-strategy>
</choice-exception-strategy>
</flow>
<flow name="CreateSrvcReqGSSInvocation" doc:name="CreateSrvcReqGSSInvocation">
<mulexml:dom-to-xml-transformer
returnClass="java.lang.String" doc:name="DOM to XML" />
<logger message="Request to GSS #[message.payload]" level="INFO"
doc:name="Logger" />
<cxf:proxy-client doc:name="SOAP"
enableMuleSoapHeaders="true" payload="envelope">
<cxf:inInterceptors>
<spring:ref bean="CreateSRFaultInterceptor" />
</cxf:inInterceptors>
</cxf:proxy-client>
<mulexml:dom-to-xml-transformer>
doc:name="DOM to XML"
</mulexml:dom-to-xml-transformer>
<http:outbound-endpoint exchange-pattern="request-response"
method="POST" address="${outbound.gss.sr}" transformer-refs="AddSoapActionHeader"
doc:name="InvokeGSSCreateSR" responseTimeout="${outbound.gss.sr.responseTimeOutInMillisec}" />
</flow>
答案 0 :(得分:0)
避免proxy-client
中的拦截器将有助于解决此问题
请参阅修改后的流程。这应该为您提供HTTP Outbound
电话的总肥皂故障响应。
<flow name="CreateSrvcReqGSSInvocation" doc:name="CreateSrvcReqGSSInvocation">
<mulexml:dom-to-xml-transformer
returnClass="java.lang.String" doc:name="DOM to XML" />
<logger message="Request to GSS #[message.payload]" level="INFO"
doc:name="Logger" />
<cxf:proxy-client doc:name="SOAP"
enableMuleSoapHeaders="true" payload="envelope">
</cxf:proxy-client>
<mulexml:dom-to-xml-transformer>
doc:name="DOM to XML"
</mulexml:dom-to-xml-transformer>
<http:outbound-endpoint exchange-pattern="request-response"
method="POST" address="${outbound.gss.sr}" transformer-refs="AddSoapActionHeader"
doc:name="InvokeGSSCreateSR" responseTimeout="${outbound.gss.sr.responseTimeOutInMillisec}" />
</flow>
希望这有帮助。