File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes JAX-WS and REST, anyone? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS and REST, anyone?" Watch "JAX-WS and REST, anyone?" New topic

JAX-WS and REST, anyone?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Trying to simplify the WS infrastructure, I'm playing with JAX-WS for implementing REStful WS. The client side is easy enough, but it seems that the server-side isn't widely explored (or at the least not publicly written about). In particular, I'm looking for a way to have a URL like

automatically routed to a method that's declared to handle the operation "doTheRestThing", and pass the parameters "ulf" and "42" to it. Mapping the operation is the easy part, but how are parameters handled? Does anyone have an example? Is this really as simple as it gets?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
I did some playing around with the service end of REST. Rather than mapping the request to a method, I mapped the request to a class - using an XML configuration file. Each class had its own doGet( request, response ) so taking apart the parameters was delegated to the class.

After much wheel-spin with class loaders I got it to where I could add a new class to the configuration without restarting the server thus making the debug cycle much faster.

Peer Reynders

Joined: Aug 19, 2005
Posts: 2933
Well, for comparison sake this is the beginning of a Restlet version.

I wouldn't be surprised if the JAX-WS REST support will vanish in future versions if JSR 311: JAX-RS: The Java� API for RESTful Web Services goes anywhere.
Peer Reynders

Joined: Aug 19, 2005
Posts: 2933
FYI: Currently wadl2java only supports client side stubs. So for interest sake I whipped together a WADL:

and generated the code

This resulted in four files:,, and

I think things may become a bit clearer once wadl2java supports the generation of server-side skeletons - however the handling of the link elements in the WADL could prove interesting.

[ UD: added a few linebreaks to preserve the layout ]
[ November 26, 2007: Message edited by: Ulf Dittmer ]
I agree. Here's the link:
subject: JAX-WS and REST, anyone?
It's not a secret anymore!