You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jaishankar <ja...@wipro.com> on 2014/10/22 10:36:13 UTC

Web service SOAP fault handling

Hi All, 
This is the route code. 
.dotry() 
.beanRef("requestProcessor","beginRequest") 
                .setBody(body()) 
                .to("cxf:bean:--id--") 
.doCatch(SoapFault.class) 
         .process(new Processor() { 
          @Override 
          public void process(Exchange exchange) throws Exception{ 
                   SoapFault fault =
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, SoapFault.class); 
                    LOG.info("fault ::::: "+ fault);                     
           } 
           .to("seda:rollbackOperation") 

Here I’m sending the SOAP request to the to() endpoint, if I get soap fault
response then doCatch() will catch it but after that I need the SOAP fault
message which was the response. 
I tried LOG messge : fault is null, tried exchange.getException() even this
it’s showing null, printed body, null. 

Question:
I’m able catch the exception but need soapfault response message in catch
block? 

I don't want to use SoapFaultIntercepter in CXF. 




--
View this message in context: http://camel.465427.n5.nabble.com/Web-service-SOAP-fault-handling-tp5757883.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Web service SOAP fault handling

Posted by Reji Mathews <co...@gmail.com>.
Looks like u want to process the metadata of the exceptions

Then it might be easier to Check docs for the standard exchange properties
to which the exception details are mapped when one is thrown.
 On 27/10/2014 9:44 am, "Jshaan51" <js...@gmail.com> wrote:

> Hi ABouchama,
>
> It's not about responding with SOAP fault. I need SOAP fault response in
> catch block because fault message contains appropriate message based on the
> request.
>
> Please help me.
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Web-service-SOAP-fault-handling-tp5757883p5758053.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Web service SOAP fault handling

Posted by Jshaan51 <js...@gmail.com>.
Hi ABouchama,

It's not about responding with SOAP fault. I need SOAP fault response in
catch block because fault message contains appropriate message based on the
request.

Please help me.





--
View this message in context: http://camel.465427.n5.nabble.com/Web-service-SOAP-fault-handling-tp5757883p5758053.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Web service SOAP fault handling

Posted by ABouchama <ti...@yahoo.Fr>.
Here's how we generate a SOAP Fault: 

public void process(Exchange exchange) throws Exception 
  { 
    // Setup the SOAP fault 
        SoapFault fault = buildFault(exchange); 
        fault.setFaultCode(Soap11.getInstance().getSender()); 
        //B2BException_Exception fault = buildFault(exchange); 
    exchange.getOut().setHeaders(exchange.getIn().getHeaders()); 
    
    exchange.getOut().setBody(fault); 
    exchange.getOut().setFault(true); 
  }

Cheers 
@a_bouchama



--
View this message in context: http://camel.465427.n5.nabble.com/Web-service-SOAP-fault-handling-tp5757883p5757988.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Web service SOAP fault handling

Posted by Aida <ai...@gmail.com>.
Hi Jaishankar,

Have you tried with the Exchange.EXCEPTION_CAUGHT property?

If I remember well, when you catch an exception, as is supposed that you are
controlling the situation, the exception moves to this property. The
exception won´t be anymore in the exchange.getException() (otherwise the
channel would detect that an exception happened and the message will be
redirected to the corresponding error handler)

You can access directly to this property using in your bean this as an
argument:

@Property(value=Exchange.EXCEPTION_CAUGHT) Exception exceptionCaught

Hope that helps you.

Greetings,

  Aida.



--
View this message in context: http://camel.465427.n5.nabble.com/Web-service-SOAP-fault-handling-tp5757883p5757906.html
Sent from the Camel - Users mailing list archive at Nabble.com.