Employee

Camel route web service & SOAPAction

Hi,
I want to add a new operation to the WSDL of a Camel route exposed as a web service with CXF,
and a specific route for this operation.
What I don't know is how I can differentiate request to execute the right route...
Do I have to implement a CXF SOAPAction interceptor ? Is there a native mechanism in Camel to do that ?
That's how I've declared my CXF Endpoint :
<cxf:cxfEndpoint id="CXFTESBRouteService" 
address="/WSRouteService"
serviceClass="com.talend.demo.ws_routeservice.WSRouteService"
wsdlURL="classpath:WEB-INF/WS_TalendESBDemo.wsdl" />

That's my (very simple) route :
from("cxf:bean:CXFTESBRouteService").to("log:test");

Thanks !
3 REPLIES
Employee

Re: Camel route web service & SOAPAction

Hi,
Looks like you're implementing a service with multiple operations. So what you are asking, I think, is what is the differentiator that would tell you on a route what operation was invoked. The answer to that is a header called "operationName".
The easiest way to implement what you want would be using a content based router or, in a bit more elegant way, using a recipient list using one route/endpoint per operation, kinda like below (assuming your wsdl contract has operations named "myOperation1" and "myOperation2"):
from("cxf:bean:CXFTESBRouteService")
.to("log:test")
.recipientList(simple("direct:${header.operationName}"));
from("direct:myOperation1").whatever-needs-to-be-done-for-myOperation1();
from("direct:myOperation2").whatever-needs-to-be-done-for-myOperation2();

You can see an example of the above in action in the camel-example-cxf-tomcat shipped with the distribution.
I hope this helps.
Employee

Re: Camel route web service & SOAPAction

Since you mentioned SOAPAction explicitly, Camel also propagates the cxf Header.HEADER_LIST and SoapBindingContstants.SOAP_ACTION headers, so that should be available as well.
Employee

Re: Camel route web service & SOAPAction

That's what I was looking for Smiley Happy
Thank you Hadrian !
Bahaaldine