Description of problem: I am currently having a SOAP consumer that has a CAMEL implementation that calls a web service. The returned response from the backend is a SOAP fault. I wish to get the fault details and return a custom/modelled SOAP response back to the caller via a messagecomposer. However, in the CAMEL exchange, the fault details are null. Version-Release number of selected component (if applicable): switchyard runtime version is 1.1.1-p5 How reproducible: Always Steps to Reproduce: 1. Create a web service provider that returns a SOAP fault detail 2. Create a web service consumer that implements a Camel route and calls the backend web service via SOAP binding 3. Invoke the web service consumer Actual results: In Camel, exchange.EXCEPTION_CAUGHT exception message has the details as null Expected results: The SOAP fault details should be present in the exchange.EXCEPTION_CAUGHT exception message Additional info: The SOAPMessageComposer.java is returning a detailNode try { if (soapBody.hasFault()) { // peel off the Fault element SOAPFault fault = soapBody.getFault(); if (fault.hasDetail()) { Detail detail = fault.getDetail(); // We only support one entry at this moment DetailEntry entry = null; Iterator<DetailEntry> entries = detail.getDetailEntries(); if (entries.hasNext()) { entry = entries.next(); } if (entry != null) { Node detailNode = entry.getParentNode().removeChild(entry); message.setContent(detailNode); return message; } } }
Created attachment 879487 [details] External WS by Wayne
Created attachment 879488 [details] Proxy by Wayne
Created attachment 879502 [details] Patch to test Hi Wayne, I am attaching a patch that needs to be copied onto modules/system/layers/soa/org/switchyard/component/camel/switchyard/main Please test this and let me know.
Hi Magesh I have tested it. The behaviour still remains the same. I am not seeing the details in the exception message.
Hi Wayne, With handleFault set to false, in soapUI I get the following result: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/> <soap:Body> <SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <faultcode>SOAP-ENV:Fault</faultcode> <faultstring>SWITCHYARD035448: Send Failed</faultstring> <detail> <PO:order xmlns:PO="http://webservice_producer/goodbyeworld"> <symbol xmlns="http://webservice_producer/goodbyeworld">SUNW</symbol> </PO:order> </detail> </SOAP-ENV:Fault> </soap:Body> </soap:Envelope> and with handleFault set to true, I see this in the log: [stdout] (http-/127.0.0.1:8080-25) =====in exception handling Service====== [stdout] (http-/127.0.0.1:8080-25) ======== The exception is =======CamelExceptionCaught [stdout] (http-/127.0.0.1:8080-25) ======== switchyard exchange msg is =======[PO:order: null] Could you be more specific as to what is null? Please not I tested the sayGoodbye method. I will attach my log for both the test run
Created attachment 879827 [details] server log by Magesh
Hi Magesh When handleFault is set to true, as you have tested, the exception message becomes [PO:order: null] The whole fault details should be seen as below in the camel exception. As without the details the fault handler will not be able to model and return a custom fault back to the consumer. <PO:order xmlns:PO="http://webservice_producer/goodbyeworld"> <symbol xmlns="http://webservice_producer/goodbyeworld">SUNW</symbol> </PO:order>
Wayne, The exception message is a org.w3c.dom.Node. If you properly print the node in the bean, then the entire detail will be there.
Okay, I have attached another patch that goes along with the earlier one. This needs to be copied onto modules/system/layers/soa/org/switchyard/component/soap/main I have changed the way to retrieve the fault details in hihiServiceBean. I have attached that too. Please note there is no need to use any custom composer.
Created attachment 882522 [details] additional patch
Created attachment 882523 [details] modified bean
Hi Magesh, it is now working as expected.