[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How-to: Return SOAPFault from JMS Queue Processor


I've found multiple examples and forums posts regarding this, but not
exactly like what I have.

I've configured CXF Endpoint using Blueprint XML ( use XML tag cxfEndpoint
), and I forward SOAP requests to JMS queue - different for each SOAPAction.

<camelcxf:cxfEndpoint id="SoapWebserviceEndpoint" ... />

<camelContext id="SOAPWebservice_Master" xmlns="";>
<route id="Default">
            <from uri="SoapWebserviceEndpoint"/>
            <log message="Received SOAP Request."/>
                    <simple>'GetVersion' ==
                    <log message="Forward SOAP call to GetVersion."/>
                    <to uri="activemq:queue:SOAPWebservice/GetVersion"/>
exceptionType="java.lang.IllegalStateException" message="Method not
implemented. SOAP Action: ${in.headers['SOAPAction']}." />


Works like a charm. No problem. Well, until there is a problem --

General idea is, to have "ExceptionHandler" queue, that will handle
exception and return "simple" SOAPFault, like this:

<soap:Envelope xmlns:soap="";>
         <faultstring>Method not implemented. SOAP Action:

I've added ( as sibling to route Default ):

        <route id="CatchException">
            <from uri="activemq:queue:SOAPWebservice/HandleException"/>
            <log message="Caught Exception. Will pass it to the Exception
Handler Processor now."/>
            <process ref="ExceptionHandlerProcessor"/>

and at the beginning I've added:

<onException useOriginalMessage="true">
    <redeliveryPolicy maximumRedeliveries="0"/>
    <to uri="activemq:queue:SOAPWebservice/HandleException" />

But now, I get:

<soap:Envelope xmlns:soap="";>
         <faultstring>Part {}parameters should be of type
com.example.soap.model.soapwebservice.GetSoapMethodResponse, not

Exception Handler ( bean ExceptionHandlerProcessor ) is like:

public void process(final Exchange exchange) throws Exception {
        final Message message = exchange.getOut();

I've checked RHEL, Talend, ... documentation, like this:

And this all works using direct and similar routeing, until I do not move
routing to the JMS queue. What am I doing wrong?

Kind Regards,

Miroslav Beranič