Question

i have a mule service in which it contains a proxy service and client.When i give request to client it is throwing some exception.while throwing the exception it is sending one soap fault xml in which it contains details tag which i need to display it in the response.I am using inInterceptor in soap client to access the fault and the class used is CheckFaultInterceptor. At present i am able to access only the fault string from soap client.But my requirement is to access the entire soap fault xml.Please help me. my mule configuration.xml is:

 <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="&quot;document/http://siebel.com/CustomUI:CreateSR1&quot;" />
</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>
Was it helpful?

Solution

Avoiding interceptors in the proxy-client will help in solving this scenario

See the modified flow. This should provide you with the total soap-fault response from the HTTP Outbound call.

<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>

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top