Forum Home » Fuse Distributions » Fuse ESB

Thread: Calling RESTful web service from Camel Route

 

Permlink Replies: 6 - Last Post: Aug 14, 2012 5:49 AM Last Post By: davsclaus Threads: [ Previous | Next ]
rmahajan

Posts: 3
Registered: 07/19/12
Calling RESTful web service from Camel Route
Posted: Jul 19, 2012 12:50 PM
  Click to reply to this thread Reply
Hi

Can any one post a sample example of calling RESTful web service from Camel route ?

Thanks
michal.warecki

Posts: 49
Registered: 01/23/11
Re: Calling RESTful web service from Camel Route
Posted: Jul 31, 2012 2:17 PM   in response to: rmahajan in response to: rmahajan
  Click to reply to this thread Reply
On http://camel.apache.org/cxfrs.html there is "How to invoke the REST service through camel-cxfrs producer" part.
njiang

Posts: 572
Registered: 09/17/07
Re: Calling RESTful web service from Camel Route
Posted: Aug 10, 2012 1:39 AM   in response to: rmahajan in response to: rmahajan
  Click to reply to this thread Reply
You can also use camel-http or camel-http4 or camel-ahc to send the request to the RESTful web service at the same time.

Willem
rmahajan

Posts: 3
Registered: 07/19/12
Re: Calling RESTful web service from Camel Route
Posted: Aug 10, 2012 1:29 PM   in response to: njiang in response to: njiang
  Click to reply to this thread Reply
Bylooking at cxfrs documentation, I am guessing that this cxfrs component is used for calling RESTful web service inside ESB. I am trying to call REST web service deployed on application server located on different box. Camel route in Fuse IDE has no knowledge of what Java class definition being used to create that RESTful web service. (that being the whole point of using web services).

So I started looking at HTTP component where I called REST web service successfully however I have not figured out yet how to pass parameters dynamically in the URL. For example if URL to call web service is http://remote-host:8080/Report/MyReport?id=123
I would like to know how I can pass this parameter 123 and not hardcode it.

Thanks
Ram
njiang

Posts: 572
Registered: 09/17/07
Re: Calling RESTful web service from Camel Route
Posted: Aug 13, 2012 12:44 AM   in response to: rmahajan in response to: rmahajan
  Click to reply to this thread Reply
you can set the header of "CamelHttpQuery" or "CamelHttpURI" as you want dynamically before routing the message to the camel-http endpoint.

Willem
rmahajan

Posts: 3
Registered: 07/19/12
Re: Calling RESTful web service from Camel Route
Posted: Aug 13, 2012 9:16 PM   in response to: njiang in response to: njiang
  Click to reply to this thread Reply
Hi

Can you please send me an example of CamelHttpQuery or CamelHttpURI ?

My RESTful web service is deployed on a separate Tomcat app server (totally separate than whatever is running in FUSE IDE). I can execute this REST service from Internet Explorer from URL like http://localhost:8080/Reports/myReport?id=123

I have been struggling to find a way to set the value of this parameter "id" dynamically on the fly as per incoming message content.

Thanks
RM
davsclaus

Posts: 1,893
Registered: 10/14/08
Re: Calling RESTful web service from Camel Route
Posted: Aug 14, 2012 5:49 AM   in response to: rmahajan in response to: rmahajan
  Click to reply to this thread Reply