You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dharini <dh...@polarisft.com> on 2013/11/12 10:55:29 UTC

Restful webservice call

I am trying to invoke a restful webservice using camel. Below is my line of
code

Component component = new org.apache.camel.component.mina.MinaComponent();
			context.addComponent("tcp", component);
			
			Component component1 = new org.apache.camel.component.cxf.CxfComponent();
			context.addComponent("cxf", component1);
			try
			{
			context.addRoutes(new RouteBuilder() {
				public void configure() {
					from("mina:tcp://localhost:6789?textline=true&sync=true")
					
.to("cxfrs:http://localhost:1977/RESTfulWebserviceExample/rest/ConversionService/FeetToInch/2");
				}

						});
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}
			context.start();
			Thread.sleep(10000000);
			context.stop();
			
I am getting below exception
15:21:01.253 [Camel (camel-1) thread #5 - MinaThreadPool] ERROR
o.a.c.processor.DefaultErrorHandler - Failed delivery for (MessageId:
ID-N6359-52056-1384249748841-0-3 on ExchangeId:
ID-N6359-52056-1384249748841-0-4). Exhausted after delivery attempt: 1
caught: java.lang.NullPointerException
java.lang.NullPointerException: null
	at
org.apache.camel.component.cxf.jaxrs.CxfRsProducer.populateCxfRsProducerException(CxfRsProducer.java:302)
~[camel-cxf-2.10.4.jar:2.10.4]

Please suggest me where I need to correct.



--
View this message in context: http://camel.465427.n5.nabble.com/Restful-webservice-call-tp5743082.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Restful webservice call

Posted by Sergey Beryozkin <sb...@gmail.com>.
I can only assume that a cxfrs producer does not get the correct 
invocation context setup and fails to invoke, try few other Camel 
producers, I suspect though a context originating from a mina consumer 
is not complete

Cheers, Sergey
On 12/11/13 09:55, dharini wrote:
> I am trying to invoke a restful webservice using camel. Below is my line of
> code
>
> Component component = new org.apache.camel.component.mina.MinaComponent();
> 			context.addComponent("tcp", component);
> 			
> 			Component component1 = new org.apache.camel.component.cxf.CxfComponent();
> 			context.addComponent("cxf", component1);
> 			try
> 			{
> 			context.addRoutes(new RouteBuilder() {
> 				public void configure() {
> 					from("mina:tcp://localhost:6789?textline=true&sync=true")
> 					
> .to("cxfrs:http://localhost:1977/RESTfulWebserviceExample/rest/ConversionService/FeetToInch/2");
> 				}
>
> 						});
> 			}
> 			catch (Exception e)
> 			{
> 				e.printStackTrace();
> 			}
> 			context.start();
> 			Thread.sleep(10000000);
> 			context.stop();
> 			
> I am getting below exception
> 15:21:01.253 [Camel (camel-1) thread #5 - MinaThreadPool] ERROR
> o.a.c.processor.DefaultErrorHandler - Failed delivery for (MessageId:
> ID-N6359-52056-1384249748841-0-3 on ExchangeId:
> ID-N6359-52056-1384249748841-0-4). Exhausted after delivery attempt: 1
> caught: java.lang.NullPointerException
> java.lang.NullPointerException: null
> 	at
> org.apache.camel.component.cxf.jaxrs.CxfRsProducer.populateCxfRsProducerException(CxfRsProducer.java:302)
> ~[camel-cxf-2.10.4.jar:2.10.4]
>
> Please suggest me where I need to correct.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Restful-webservice-call-tp5743082.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com