camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Wolf <cwolf.a...@gmail.com>
Subject Re: Need help with cxfrs component, actually RESTful service consumption, in general
Date Fri, 29 Mar 2013 15:09:24 GMT
Ok, before I go the CXF-RS route (no pun intended) I want to try
restlet.  To clarify - can I use restlet to consume any RESTful
service,
or does the service have to be a restlet service?

The example client-side code on the the page: http://camel.apache.org/restlet

Has:

from("direct:start-auth").to("restlet:http://localhost:" + port +
"/securedOrders?restletMethod=post");
That is all we need. We are ready to send a request and try out the
restlet component:
final String id = "89531";

Map<String, Object> headers = new HashMap<String, Object>();
headers.put(RestletConstants.RESTLET_LOGIN, "admin");
headers.put(RestletConstants.RESTLET_PASSWORD, "foo");
headers.put("id", id);

String response =
(String)template.requestBodyAndHeaders("direct:start-auth", "<order
foo='1'/>", headers);

I don't need to authenticate, and I only need to do a GET, but the URL
I'm consuming from
has a query string with a parameter whose value is an Xpath

http://localhost:4040/some/service?param1=/root/level2[id='xyz']

Do I need to URL-Encode the first '?' so I can append "?restletMethod=GET"

?

Thanks,

Chris

On Fri, Mar 29, 2013 at 4:05 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> Hi
>
> There is also camel-restlet
> http://camel.apache.org/restlet
>
> It may be easier to get hold of and use. But CXF may have more
> configuration options, but is also IMHO harder to get started with
> using - some of that is us to blame, for not having better
> documentation and samples. And the fact that IMHO camel-cxf has both
> WS and RS in the same big giant component, which IMHO is becoming a
> problem and hurts the lightweightness of Camel and CXF.
>
> You may also take a look at some of the articles about Camel. There
> should be some good ones about REST etc
> http://camel.apache.org/articles
>
> For example this article
> http://www.ofbizian.com/2012/02/apache-camel-rest-example.html
>
> But there is others as well.
>
>
>
> On Thu, Mar 28, 2013 at 11:35 PM, Chris Wolf <cwolf.algo@gmail.com> wrote:
>> So I have the book, "Camel In Action", which is a very good and
>> thorough treatment of camel-core. However, now my development efforts
>> are starting to hit severe turbulence upon making the jump from
>> camel-core to camel-cxf, in particular, how to consume a RESTful
>> service?
>>
>> I read these:
>> http://camel.apache.org/cxfrs.html
>> http://camel.apache.org/cxf-bean-component.html
>>
>> ...but these pages seem to be reference pages for people who have
>> already mastered camel-cxfrs - not newbies, like me.  Can anyone point
>> me to an end-to-end example?  I don't need the server-side - this is
>> legacy and produces XML.
>>
>> N.B. Outside of Camel, I have had much previous experience using CXF
>> for JAX-WS style services, client and server  (never JAX-RS, though)
>>
>> Thanks for any help,
>>
>>   -Chris
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message