You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by helander <le...@gmail.com> on 2012/12/12 15:49:43 UTC

Error handling when using camel-cxf

I have a solution based on camel-cxf, where soap requests are received by a
cxf-endpoint and processed by a camel route that ends with a jms endpoint.
At the other end of the jms-"connection" is the actual service
implementation, that will create the soap response and send it back to the
jms-endpoint and further to the cxf-endpoint. All of this his deployed in a
Karaf container using its standard web server (pax-web).

I have tried to find documentation of what kind of errors that are detected
by the involved components and what kind of errors that get reported (and
how) for each type of error.

I am looking for anything that could help getting a clearer view on this:

What kind of HTTP error codes (4xx, 5xx) are reported and what component
detects/reports this? 
Are SOAP faults generated? When? What component detects/reports this?

Thanks

Lars



--
View this message in context: http://camel.465427.n5.nabble.com/Error-handling-when-using-camel-cxf-tp5723955.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Error handling when using camel-cxf

Posted by Aki Yoshida <el...@gmail.com>.
Hi Lars,
So the camel endpoint you have at the end of the route is a cxf
endpoint, as you talk about a SOAP fault from the end of the route?

In a request-response scenario, you will get the SOAP fault
transferred back to the other end of the route and this is typically
returned as an HTTP 500 SOAP Fault to the caller by the cxf-endpoint.
But you could technically change the fault/response message somewhere
in the path to e.g., change the HTTP code, or its response body, etc
if that is required.

An unchecked exception during the processing after the cxf-endpoint
takes the message will result in a SOAP fault from the cxf-endpoint
and consequently you will see the SOAP fault message at your client.

But if the exception occurs before entering the cxf endpoint (e.g.,
your client didn't even reach the cxf endpoint), you will get a
different HTTP error response 404 etc.

regards, aki

2012/12/13 helander <le...@gmail.com>:
> Aki, thanks for the feedback.
>
> At the moment I am only using request/response (InOut).
>
> If the service (called by the end of the route) returns a SOAP Fault, will
> then the cxf-endpoint make sure that the http status code returned to the
> caller becomes 500?
>
> Do the cxf-endpoint force the return of any other 4xx/5xx code? If so, in
> which situations?
>
> Do the cxf-endpoint ever create a SOAP Fault or does it only return SOAP
> Faults originating from the service implementation? If the cxf-endpoint
> creates SOAP Faults, under which circumstances does this happen?
>
> Thanks
>
> Lars
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Error-handling-when-using-camel-cxf-tp5723955p5724021.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Error handling when using camel-cxf

Posted by helander <le...@gmail.com>.
Aki, thanks for the feedback.

At the moment I am only using request/response (InOut).

If the service (called by the end of the route) returns a SOAP Fault, will
then the cxf-endpoint make sure that the http status code returned to the
caller becomes 500?

Do the cxf-endpoint force the return of any other 4xx/5xx code? If so, in
which situations?

Do the cxf-endpoint ever create a SOAP Fault or does it only return SOAP
Faults originating from the service implementation? If the cxf-endpoint
creates SOAP Faults, under which circumstances does this happen?

Thanks

Lars



--
View this message in context: http://camel.465427.n5.nabble.com/Error-handling-when-using-camel-cxf-tp5723955p5724021.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Error handling when using camel-cxf

Posted by Aki Yoshida <el...@gmail.com>.
The behavior differs depending on the configuration. I'll try to give
a short overview.

If you have a request-response type service, the exception is normally
transferred to the caller. In that case, the corresponding soap fault
is returned to the caller and the http code is 500 for such general
server-side runtine errors. For some other specific exceptions like
authorization etc, the code can be 4xx by conforming to the standard.

If you have a oneway type service, the exception is not normally
transferred back to the caller. A oneway service assumes an
asynchronous processing by default.. So, the exception thrown
somewhere in one processing segment will be handled in that segment
and the preceding segments will not see the exception.

If you have a oneway type service but want to get the soap fault at
your client, you need to enforce the synchronous behavior from your
client up to the point where this exception might occur. That means,
for instance, you need to set the synchronous flag and additionally
set the "org.apache.cxf.oneway.robust" property to true at the cxf
endpoint.

regards, aki

2012/12/12 helander <le...@gmail.com>:
> I have a solution based on camel-cxf, where soap requests are received by a
> cxf-endpoint and processed by a camel route that ends with a jms endpoint.
> At the other end of the jms-"connection" is the actual service
> implementation, that will create the soap response and send it back to the
> jms-endpoint and further to the cxf-endpoint. All of this his deployed in a
> Karaf container using its standard web server (pax-web).
>
> I have tried to find documentation of what kind of errors that are detected
> by the involved components and what kind of errors that get reported (and
> how) for each type of error.
>
> I am looking for anything that could help getting a clearer view on this:
>
> What kind of HTTP error codes (4xx, 5xx) are reported and what component
> detects/reports this?
> Are SOAP faults generated? When? What component detects/reports this?
>
> Thanks
>
> Lars
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Error-handling-when-using-camel-cxf-tp5723955.html
> Sent from the Camel - Users mailing list archive at Nabble.com.