You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2012/03/26 17:25:56 UTC
Re: RESTful web service support from Camel
Hi,
Forwarding to the users list.
On 26/03/12 15:36, Zemin Hu wrote:
> Hi,
> I have couple of RESTful web service that I want to use Camel as integration
> point. I had a brief review for restlet which is supposed to be the
> solution, but from I have seen, it's not straight forward to use:
> 1. straight forward support/constrcut RESTful dynamic URL for both<from/>
> and<to/>:
> http://host:port/services/{uid}/table1/{item_id}
> 2. it supports request methods GET,POST,PUT, DELETE, I did not see how Camel
> handles these methods.
>
> Can Camel handle dynamic URL construction with variables? in ideal case, it
> should support:
> <from uri="servlet:///myservices/{uid}/table1/{item_id}/1.0" />
> <to
> uri="http://host:port/services/{uid}/table1/${header.type}?access_token=12345
> />
One option is to use a cxfrs component:
http://camel.apache.org/cxfrs.html
The variation on it is to use the Camel transport and link directly to
CXF JAXRS endpoint declarations (jaxrs:server), example
<jaxrs:server address="camel://direct:bookStore"
serviceClass="service.BookStoreImpl"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- JMS to CXF JAX-RS -->
<route>
<from uri="jms://test.bookStore"/>
<to uri="direct:bookStore"/>
</route>
<!-- Jetty to CXF JAX-RS -->
<route>
<from
uri="jetty:http://0.0.0.0:9002/bookstore?matchOnUriPrefix=true"/>
<to uri="direct:bookStore"/>
</route>
</camelContext>
HTH, Sergey
>
> Since many social network APIs are in this format, for instance:
> http://graph.facebook.com/{uid}/picture
> http://graph.facebook.com/{uid}/friends
> http://graph.facebook.com/{uid}/{about_everything}
>
> Can Camel at least support dynamic construction of URL of out box even
> without PUT and DELETE support?
> I don't know how big effort is needed to do this. If required, I am willing
> to contribute.
> Zemin
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/RESTful-web-service-support-from-Camel-tp5595408p5595408.html
> Sent from the Camel Development mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
Re: RESTful web service support from Camel
Posted by Reuben Garrett <re...@gmail.com>.
CXF is probably very relevant to your scenario, as Sergey indicates
(although i haven't used it yet).
for the general case of "dynamic" endpoints/URIs, check out these
resources:
http://camel.apache.org/dynamic-router.html
http://camel.apache.org/recipient-list.html
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
~ Reuben
Re: RESTful web service support from Camel
Posted by Reuben Garrett <re...@gmail.com>.
Zemin,
let's take this conversation to the users' list <us...@camel.apache.org>,
where participants focus on usage issues and will be better equipped to
assist you.
if you're interested in dynamic endpoint construction, take a look at these
resources:
http://camel.apache.org/dynamic-router.html
http://camel.apache.org/recipient-list.html
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
are any of these patterns helpful for your scenario?
~ Reuben
On Thu, Mar 29, 2012 at 10:41, Zemin Hu <ze...@hotmail.com> wrote:
> To me, solving dynamic construction of endpoint is only correct way to do
> it inside of Camel.
>
Re: RESTful web service support from Camel
Posted by Zemin Hu <ze...@hotmail.com>.
I looked at the this CXFRS component for Rest endpoint, it seems to me no use
to me. If I am writing Spring controllers like the sample code:
@RequestMapping("/services")
@Controller
class MyController {
@RequestMapping("/{id1}/resource/{id2}")
public @ResponseBody String method1(@PathVariable String id1, @PathVariable
String id2) {
...
}
}
I will be directly writing a regular web app for Restful web services with
much more control like I am doing right now, why do I need Camel plus CXFRS?
I looked restlet approach, it solved construction for <from/> but not for
<to/>, and configuration is very intrusive-it requires a separate servlet in
addition to normal Camel servlet, it also requires to change appContext.xml
and web.xml. I would use it only if it solve Restful endpoint for both
<from/> an <to/> at same time.
To me, solving dynamic construction of endpoint is only correct way to do it
inside of Camel.
--
View this message in context: http://camel.465427.n5.nabble.com/RESTful-web-service-support-from-Camel-tp5595408p5604193.html
Sent from the Camel Development mailing list archive at Nabble.com.