Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Is It Time For WADL in JAX-RS?

Is It Time For WADL in JAX-RS?

Leia em Português

This item in japanese

At this years JavaOne there was a session titled 'JavaEE.Next(): Java EE 7, 8, and Beyond' at which the panel, including Oracle, IBM, Red Hat and Caucho, discussed various aspects of Java EE and answered questions from the audience. However, despite the fact that the focus was intended to be on things such as PaaS, mobile and NoSQL, there was a lot of interest on REST and particularly around WADL. Now WADL isn't new, having been around and discussed fairly widely for at least 7 years and as we reported in 2005:

For those who would like to describe their XML over HTTP service, a lot of options have been discussed, from SMEX-D (proposed by Tim Bray) to NSDL, and a host of alternatives. However, most of those proposals were made in 2005 or earlier, and since then none has really seen much adoption.

Marc Hadley (one of the Spec Leads for JSR-311, a Java API for RESTful services) back in 2005 proposed  WADL, the Web Application Description Language.

Since then, a number of people have been building tools to support WADL. Yahoo architect  Mark Nottingham is maintaining a stylesheet to generate documentation from WADL.

As with a few other things around REST, in the past WADL appeared to fracture the community into those who believe it's necessary and those who don't. For instance, back in 2007 Mark Baker had this to say:

[...] all services expose the same interface. This is what provides the majority of its loose coupling, and is the principle differentiator from RPC. 

So if you’re writing (or generating) contract/interface-level code which can’t late-bind to all resources, everywhere, you’re not doing REST (10 kudos to whomever identifies the specific constraint being violated).

Cut the cord already! RPC is dead. You’re not in Kansas anymore.

And those who like it often compare it with WSDL:

Remember about WSDL, where you can simply generate this interfacing code to the web services? That was pretty nifty. That saved a lot of work. Can’t we do the same with RESTful web services? Well, yes, you can. And yes, finally I’m coming to my point. You can do this with WADL. WADL stands for Web Application Description Language. It allows you to describe essentially any HTTP-based API to any web service Including SOAP webservices, if you would feel so inclined. But you can also describe the flickr API, the twitter API and the yahoo API in WADL. And guess what it can do… It can generate client-side proxy code to interface with these Web APIs. Yes, it’s like WSDL, but more general. Generalized to also support REST and basically any kind of (I guess) XML-based web service.

But this can be a double-edged sword as one of the commenters pointed out:

You've made a few fundamental mistakes in this article. You said "What I refer to here is that the format of results and data you send to a
REST webservice is not more precisely defined than “dude, it’s XML!”". Then what may I ask are media types? They are precisely definitions of message formats, associated with information on how to process the data and access new resources based on links present in the representation.

Read up on some of Roy Fielding's work ; )

Oh and by the way, WADL is probably not going to last long, and is actually not very RESTful at all (creates tighter coupling between client and service provider).

For a few years between 2005 and 2008 this debate raged along with many others in the REST arena. In recent times it appears to have died down and a more pragmatic outlook has taken hold, with some groups deciding that despite any perceived issues with WADL (e.g., whether or not it is RESTful) it should be a supported option for developers, and other groups eschewing it completely. For instance, Jersey the JAX-RS reference implementation supports WADL out of the box. But some other JAX-RS implementations, such as RESTeasy, are not so definitive.

Which leads us back to the JavaOne session, where several people in the audience, including the JAX-RS specification lead, were keen to learn whether or not WADL should be a fully supported aspect of a future version of JAX-RS. Whilst the panel were non-committal, referring to the plethora of RESTful services that have been implemented successfully without WADL, many in the audience appeared to be supportive of adding WADL to JAX-RS. Since the emphasis on WADL over the past few years has been relatively low-key, is this specifically a Java and JAX-RS requirement or is WADL on the rise again? And if so, is WADL any better today in terms of RESTful services and applications than it was several years ago or are developers just more pragamtic today than they were back then?

Rate this Article