Apache Camel: Route from the Camel Serb Cat to the cxfbean component

Problem Description: I cannot drive from my camel servlet to cxfbean. Route initialization fails with the following error message:

"Failed to create route route1 at: >>> To[cxfbean:fooEndpoint] <<< in route: Route[[From[servlet:///?servletName=BwsServlet]] -> [To[cxfb... because of Failed to resolve endpoint: cxfbean://fooEndpoint due to: null". 

The servlet starts working fine without cxfbean.

UPDATED . Please note that I intend to use the Camel Cxf Bean component as opposed to the Camel Cxf Bean .

What I want to achieve: I manage the camel servlet in Tomcat. I have a Bean that implements my webservice interface (generated by WSDL CXF). I want to process the bodies of the XML messages before passing them to this bean web service. I would like to use the cxf Bean component as opposed to the cxf bean endpoint, since I do not want my cxf endpoint to listen on the network port in addition to the camel servlet already running.

What my code looks like: My camel-config.xml looks like this:

 <bean id="bwsRouteBuilder" class="local.com.foo.BwsRouteBuilder"/> <bean id="fooEndpoint" class="local.com.foo.FooBws"/> <camel:camelContext id="bws"> <camel:routeBuilder ref="bwsRouteBuilder"/> </camel:camelContext> 

My route builder (written in Java DSL) looks like this:

 public void configure() throws Exception { from("servlet:///?servletName=BwsServlet") // some processing of message here .to("cxfbean:fooEndpoint"); } 

UPDATED . Pay attention to the cxfbean URI format in the above code as here .

My web.xml is as follows:

 <servlet> <servlet-name>BwsServlet</servlet-name> <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>BwsServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> 

camel-cxf is included as a dependency in my pom.xml.

Where I have been asking for help for so long: I followed the documentation in the Apache Camel cxfbean description and then the stack overflow. I hope my question is straightforward, I'm new to Camel.

Thanks a lot in advance for your thoughts.

+4
source share
1 answer

If you want to use cxf bean, you need to write "cxf: bean: fooEndpoint" in your route (you will forget: between cxf and bean).

 public void configure() throws Exception { from("servlet:///?servletName=BwsServlet") // some processing of message here .to("cxf:bean:fooEndpoint"); } 
-1
source

All Articles