#1 2011-06-13 09:51:18

bahaaldine
Talend Team
Registered: 2011-06-10
Posts: 14

Camel route web service & SOAPAction

Tags: [camel, cxf, 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 :

Code:

<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 :

Code:

from("cxf:bean:CXFTESBRouteService").to("log:test");

Thanks !

Last edited by bahaaldine (2011-06-13 13:26:42)

Offline

#2 2011-06-14 00:24:11

hzbarcea
Talend Team
Registered: 2011-02-21
Posts: 7

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"):

Code:

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.

Offline

#3 2011-06-14 00:44:58

hzbarcea
Talend Team
Registered: 2011-02-21
Posts: 7

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.

Offline

#4 2011-06-15 09:38:15

bahaaldine
Talend Team
Registered: 2011-06-10
Posts: 14

Re: Camel route web service & SOAPAction

That's what I was looking for smile

Thank you Hadrian !
Bahaaldine

Offline

Board footer

Powered by FluxBB