Good day.
I think your question can reside at a number of different levels, but
I'll take a stab at the simplest and most obvious. Hopefully this
isn't so simple as to be of no use.
Here are a few lines of code from one of my JUnit tests, that acts as
a client doing a GET against a restlet:
void testme() {
Client client = new Client(Protocol.HTTP);
baseUri = host + props.getProperty(KEY_URI);
Request request = new Request(Method.GET, baseUri + "/" +
props.getProperty("callsign"));
Response response = client.handle(request);
Status status = new Status(response.getStatus().getCode());
assertTrue("test lookup callsign",
Status.SUCCESS_OK.equals(status));
System.out.println(response.getEntity().getText());
}
The Javadoc for org.restlet.data.Response shows that you can retrieve
the entity in a number of different forms, including plain text, a DOM
representation, and others, and at which point you're free to do with
it what you will. I have not seen anything in print in this venue on
the subject of taking the returned entity and casting it into an
application POJO. My guess is that if you want the marshaling that
attends typical WSDL-based techniques, you'll probably have to arrange
for it yourself, perhaps with something Castor-like.
Hopefully that helps, and isn't too elementary.
Mark
On Oct 20, 2008, at 3:12 PM, buzzterrier wrote:
Hello,
From trying out the sample apps and searching the web I have a
pretty good sense
on how to publish a restful service, but not on how to consume one.
My previous
experience with web services are WSDL based, which are pretty
straight forward
for marshaling the xml into a pojo. But I am not sure what the best
approach is
for REST, since there is no XSD to work with.
Can some of you comment on how you are consuming these resources? Am
I missing
the obvious?<g>
Thx!