You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cmland <qi...@gmail.com> on 2012/08/29 08:45:03 UTC
how can i send message to cxf component with producerTemplate?
my route config:
<camelContext id="myContext" xmlns="http://camel.apache.org/schema/spring"
>
<route>
<from uri="cxf:bean:helloService"></from>
<to uri="mock:end"></to>
</route>
</camelContext>
my cxf config:
<cxf:cxfEndpoint id="helloService" address="/addOrder"
serviceClass="com.xxx.IOrderService">
</cxf:cxfEndpoint>
when the route work in a web container, i want to send message to uri
(cxf:bean:helloService) with producerTemplate,but it's not work and throws :
java.net.MalformedURLException: no protocol: /addOrder
code like this: (springContext is XmlWebApplicationContext)
CamelContext camelContext =
(CamelContext)springContext.getBean("myContext");
ProducerTemplate template = camelContext.createProducerTemplate();
Exchange exchange = new DefaultExchange(camelContext);
exchange.getIn().setBody("message");
template.send("cxf:bean:helloService",exchange);
--
View this message in context: http://camel.465427.n5.nabble.com/how-can-i-send-message-to-cxf-component-with-producerTemplate-tp5718227.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: how can i send message to cxf component with producerTemplate?
Posted by Charles Moulliard <ch...@gmail.com>.
Hi,
How do you deploy your project (war in tomcat, ...) ? Which version of CXF
are you using ? Which cxf xml files do you import ? Are you using the Jetty
HTTP server to register the web service or tomcat ?
I think that your issue is described here :
http://cxf.547215.n5.nabble.com/address-in-spring-bean-definition-td567912.html
http://stackoverflow.com/questions/3793034/web-service-using-cxf-jetty-and-spring
Regards,
On Wed, Aug 29, 2012 at 8:45 AM, cmland <qi...@gmail.com> wrote:
> my route config:
> <camelContext id="myContext" xmlns="
> http://camel.apache.org/schema/spring"
> >
> <route>
> <from uri="cxf:bean:helloService"></from>
> <to uri="mock:end"></to>
> </route>
> </camelContext>
> my cxf config:
> <cxf:cxfEndpoint id="helloService" address="/addOrder"
> serviceClass="com.xxx.IOrderService">
> </cxf:cxfEndpoint>
> when the route work in a web container, i want to send message to uri
> (cxf:bean:helloService) with producerTemplate,but it's not work and throws
> :
> java.net.MalformedURLException: no protocol: /addOrder
>
>
> code like this: (springContext is XmlWebApplicationContext)
> CamelContext camelContext =
> (CamelContext)springContext.getBean("myContext");
> ProducerTemplate template = camelContext.createProducerTemplate();
> Exchange exchange = new DefaultExchange(camelContext);
> exchange.getIn().setBody("message");
> template.send("cxf:bean:helloService",exchange);
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/how-can-i-send-message-to-cxf-component-with-producerTemplate-tp5718227.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Charles Moulliard
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Twitter : @cmoulliard
Blog : http://cmoulliard.blogspot.com