After following this link
https://camel.apache.org/cxf.html#CXF-HowtothrowaSOAPFaultfromCamel
now I'm able to create a custom Fault, but I'm not able to obtain the
original fault message "Missing valid token" from the proxified service.
Instead of that I got a strange message:
"javax.xml.transform.dom.DOMSource@136bd". How can I obtain the original
fault message in order to simulate a transparent propagation of the
soapfault?

This is the code I have now:

onException(Exception.class)  
                   .process(  
                      new Processor() {  
                         public void process(Exchange exchange) throws 
Exception {                       
                                SoapFault fault = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
SoapFault.class);
                                System.out.println("Fault: " +  fault); // --> 
This returns NULL

                                Exception excep = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
Exception.class);
                                System.out.println("excep: " +  excep);
                                System.out.println("excep message: " + 
excep.getMessage());
                                System.out.println("excep cause: " +  
excep.getCause());
                                                
                                        SoapFault SOAP_FAULT = new 
SoapFault(excep.getMessage(),
SoapFault.FAULT_CODE_CLIENT);
                                        Element detail = 
SOAP_FAULT.getOrCreateDetail();
                                        Document doc = 
detail.getOwnerDocument();
                                        Text tn = doc.createTextNode("this is a 
test");
                                        detail.appendChild(tn);
                                        
                                        exchange.getOut().setFault(true);
                                        exchange.getOut().setBody(SOAP_FAULT);
                                                
                                        
exchange.setProperty(Exchange.ERRORHANDLER_HANDLED, false); 
                            exchange.removeProperty("CamelExceptionCaught");  
                         }  
                      })  
                   .handled(true)  
                   .end();
                
        from("switchyard://ProxyService")
            .process(myProc) // -->just some logging and addition of headers
            .handleFault()  
            .to("switchyard://ProxifiedService").end();



--
View this message in context: 
http://camel.465427.n5.nabble.com/Propagate-SoapFault-with-simple-Camel-proxy-tp5756164p5756276.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to