Hello Willem, thanks for the reply. Here is what I want to achieve
The platform we are developing would have the ability to deal with multiple
types of messages and protocols (soap, json, xml etc over http or anything
else). We also have a need to return specific error codes for each types of
these exceptions in a specified format. I was thinking about employing a
common exception handler that would get all the exceptions thrown in the
route and would convert it in to specific message structure and be returned
in the corresponding channel.
I think the following example clarifies what I am trying to achieve
from("cxf:bean:sampleProviderEP").process(createPrintingProcessor("Processing
A"))
.process(createExceptionProcessor("an unexpected exception"))
.process(createPrintingProcessor("Processing B"))
.to("direct:end");
exception(Throwable.class).maximumRedeliveries(0).to("direct:exception");
from("direct:exception")
.process(createPrintingProcessor("Exception Message Processor"))
.setBody(ExpressionBuilder.constantExpression(createXXXXFault()));
So as the example above shows the creatExceptionProcessor would throw an
exception and I would expect it to get to the direct:exception where the
appropriate message would be created and returned to the client (cxf
client). But when I tried, what the client sees is a fault message (that
too not wrapped in SOAP though the request was a SOAP one).
If I modify my exception handler route to have a processor that would reset
the org.apache.camel.processor.DeadLetterChannel.FAILURE_HANDLED
(effectively telling camel nothing happened bad :)) the original route gets
processed (which is not desired).
I had some luck using the tryBlock() and handle() combination but this does
not work (atleast in a straightforward way) if the routes have Splitter or
any other specific DSL types. I could get away with the the splitter and
other stuff messing with the TryType by capturing try type and then using
that to call handle() finally, but the DSL becomes really ugly.
Anyway I just want to know if there is any standard way of handling and
error and letting camel know not to process the original route that threw
the exception in a generic way (without having to declare the tryBlock()
handle() combination)?
If any one is interested in knowing what worked for me, please let me know.
But overall Camel rocks!!!!!!
Thanks
Aswin
--
View this message in context:
http://www.nabble.com/Re%3A-fault-message-on-exception-in-CXF-route-tp16766089s22882p16802312.html
Sent from the Camel - Users mailing list archive at Nabble.com.