I see that the default method is GET, but I urlendcoded the '?' that
is part of the service URL, rather then restlet URL.

However, it's getting a "no consumer error".  My route is:

from("direct:readsvc")
.to("restlet:http://localhost:4040/some/service%3Fparam1=/root/level2[id='xyz']")
.to("log:readsvc?showAll=true&multiline=true&level=INFO");

 Object response = xdsrdr.requestBody("direct:readsvc", "");

The error is:

 org.apache.camel.CamelExchangeException: No consumers available on
endpoint: Endpoint[direct://readsvc]. Exchange[Message: ]

I thought I was following the client-side pattern show on the restlet
documentation web page,
but it's not working.

So my question is can restlet be use to perform an HTTP GET on a
RESTful service that returns a string (actually an xml document)?

If so, how?

Thanks,

Chris


On Fri, Mar 29, 2013 at 11:09 AM, Chris Wolf <[email protected]> wrote:
> 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 <[email protected]> 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 <[email protected]> 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: [email protected]
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to