I have a camel-cxf web service. I use to handle all SOAP errors in the CXF SOAP Fault Interceptor. It works well.
I thought it was better to handle the Exception thrown on the Camel layer on the same layer, and wrote a simple onException script like this:
OnException (Exception.class). to ("direct: MyWSExceptionHandler");
Whenever a custom exception is thrown, I expected onException to hit (remember that I also have a SOAP error trap), but that is not the case. CXF takes over, and the message goes through interceptors, not the camel route.
Is this the expected way, or am I doing something wrong?
My CXF error trap looks like this:
@Component("SOAPFaultInterceptor") public class SOAPFaultInterceptor extends AbstractPhaseInterceptor { public SOAPFaultInterceptor() { super(Phase.MARSHAL); } public void handleMessage(Message message) throws Fault {
Can someone tell me how to fix this? I do not want the Exception thrown on the Camel layer to leave this layer unhandled.
Thanks in advance.
source share