I think students of information systems design have a tough time compared to other designers, architects and graphic designers say. A budding architect might have lived and worked in dozens of building, visited scores more and seen hundreds before they start to design their own. Information systems designers have no such grounding in examples, their prior experience sometimes confined to being the victim of poor systems.
The web has improved this situation, particularly for interface designers, but it is still hard to see into the guts of an application to learn about database structures and software architecture. Web applications do have the wonderful advantage that they can be explored, and I exploit this feature in my teaching, getting students to take well-known sites like Flickr and del.icio.us and infer, through source viewing and experimentation, the underlying conceptual data model. This works well but only occasionally can we compare our speculations with the real thing. It would be great if more sites had their systems documentation online.
I recently came across Raymond Yee’s book, Pro Web 2.0 Mashups, a spin-off from his teaching at UC Berkeley (named I only discovered recently after the family of the nearby Berkeley Castle) . I’ll be using Raymond’s book on one of my courses next year, especially since the text is generously available online. Amongst guidance on the use of a number of mashup architectures, the book contains detailed descriptions of the URL languages of sites like Flickr. Reading his book, I realised that the understanding of this language was an implicit step in the inference of the underlying data model which I had hitherto neglected to address formally in my teaching.
As far as I know, there is no equivalent of WSDL for REST so in best NIH fashion I set about creating my own XML schema for documenting URL languages based on URL templates. Here is my attempt to define the del.icio.us language. Parameters are defined first, with local names, explanations, default values and option list if applicable, followed by templates for the URLs which invoke services. An XQuery script reads the interface definition and creates a page with a form for the user to change the parameter values followed by the service URLs with each template completed with the current values of its parameters. The script is described in more detail in a chapter in the XQuery wikibook.
We are using this tool in our internal applications as an interactive site map cum interface documentation. Next year’s students can look forward to recording their understanding of web sites with this schema. Now who’s going to tell me there’s already a standard out there I’ve missed!


Chris,
Welcome to xml.com; we're all looking forward to many more such articles.
Kurt Cagle
Hi, not sure whether this does exactly what you need, but are you aware of the Web Application Description Language (WADL)?
WADL is often cited as the WSDL for RESTful services. I can't say I'm a fan as I really haven't used it, but honestly the idea doesn't really appeal to me. Part of me thinks it is essentially an YAGNI issue. RESTful interfaces revolve around documents as an interface as opposed to a function signature. This is difficult to define because in doing so you put constraints on the usage. For example, one application might expect a simple value at "/some/element/@value" whereas another application might need a more complex node-set at "/some/set/of/things".
Now, you mention it in light of understanding how the system is created. I think that is really a huge benefit of REST. You are forced to think of a service in terms of resource representations (documents) instead of an underlying system. I realize this doesn't help in teaching your students how to architect systems, while I would guess there is an important lesson in there about decoupling system design from implementation ;)
Thanks to all for pointing out WADL. I'm sure I must have seen this in the past but it had the smell of WS-* about it and I wanted something a bit more lightweight to use as a design language.
Purpose here makes a difference I think - design or deployment. A layered architecture calls for design representations at a suitable level of abstraction at each layer. Conceptual ER models seem to work OK at the data level and I'm looking for something similar to use at the interface between client and server, not just for resource-oriented interfaces but interfaces, like del.icio.us, which mix resource paths and key-value pairs in their URL language. The language will be used bottom-up to document existing sites and top-down to design them before coding, perhaps with some automation possibilities. Time is always limited in teaching so simple languages which do 80% of the job beat perfection I think.
Thanks to a blog entry I found from Joe Georgorio, I see I should also have looked at URITemplates and OpenSearch which are more the style I was looking for.
A good podcast on REST from se-radio:
http://www.se-radio.net/podcast/2008-05/episode-98-stefan-tilkov-rest
It's one of the better interviews, well worth listening to (although I'm not sure it will help your goal here)
Great article Chris!
> As far as I know, there is no equivalent of WSDL for REST
I agree this is a problem. We need a clean simple way to describe REST interfaces.
There are two related standards. One is to use the W3C WSDL version 2.0 (not yet wildly supported) which has full support for PUT and GET operations. This is kind of overkill in my opinion since WSDL is a large and complex standard.
The second option is Sun's Web Application Development Language WADL (see https://wadl.dev.java.net) WADL is not widely used.
I am a big fan or your XQuery Wikibook! Your XQuery mashup examples using DBpedia are great! Keep up the great work.
First, I appreciate your adopting my book for your course!
I'm glad that the effort I put into documenting the URL languages/patterns of sites like Flickr is useful. Spending time understanding how URLs are deployed at a given web site is certainly not a new idea -- but one I felt needed to be emphasized as being very helpful to understanding how a web site works. Not all web sites have clear URL patterns though -- but Flickr is a good example of one that does.
As already mentioned in the comments, WSDL 2.0 and WADL are akin to "WSDL for REST". I've not had much opportunity to try these specs out but I have the sense that there's not been much uptake of either. I like to look for implementations of specs to make it easier to learn (and teach) them. For WADL, I've wanted to follow up on
http://ajaxian.com/archives/google-rest-describe-wadl-toolkit
For reasons that will be obvious to Eric, I can't help but agree with his view point. REST is by its very nature a document-centric view of any given data set. In this regard, the WSDL for REST has existed for quite some time. Its called HTTP.
That said, I do believe there is room for improvement in how we allow interaction with our backend systems via a REST interface. HTML forms, quite obviously, is the most ubiquitous way to interact with a REST interface, but as the web has grown up, there are certainly contenders that have come into play that I believe are worthy of use: XForms, XUL, XAML, etc. And of course Web Forms 2.0, the assumed replacement for HTML forms. In this regard, I have long believed there needs to be a way for me, the developer, to easily interact with any given backend system -- using REST/HTTP -- doing so in my form language of choice, while at the same time knowing the proper field names and types the backend system is expecting once the given form has been PUT or POSTed to the server. A lingua franca forms binding so to speak.
From my own view point, the best way to implement just such a system is by using something that each of the major browsers already support. Of course, client-side XSLT invoked via a processing instruction is something that all major browsers support, and given the very nature of XSLT being that of a transformation language, it makes sense to utilize this mechanism to take a form description -- which could very easily be an XHTML form to ensure ease of adoption on a wide scale -- and convert that into the desired form language for further integration into our particular application. Using Aspect Oriented Programming techniques this would be as simple as defining a map for any given forms language that would be used to then transform the base XHTML form provided by the server into the specified format, whatever that might be.
Clean, simple, standards based, and solves the real problem at hand: How do we let the ever evolving world of declarative interface languages easily and quickly interact with our backend systems without having to adapt those backend systems in potentially non-standard ways?
@Chris,
>> Thanks to a blog entry I found from Joe Georgorio, I see I should also have looked at URITemplates and OpenSearch which are more the style I was looking for.
From a URI perspective, I absolutely agree! URITemplates is one of those technologies that I believe will quickly reach critical mass because it solves a real problem that nothing else even comes close to solving.
And OpenSearch is a fantastic representation of how to implement just such a mechanism correctly. I'm glad to see you stumbled upon both of these. They're both well worth your time digging down deep into.
@David and Eric - I realise I never did quite get the distinction between a resource path and a set of keyword parameters in a URI. Conceptually
http://del.icio.us/morelysq/xml
http://del.icio.us/bookmarks?morelysq;xml http://del.icio.us/bookmarks.php?user=morelysq&tag=xml
or any other variants are all conceptually function calls with 2 parameters, and only the syntax is different. There is tension between more abstract formats which don't expose the underlying implementation, decoupled via server-side rewrite rules, and self-describing formats. Indeed, the path style surely needs more documenting not less?
So I really like David's notion of a generic mechanism decoupling HTML forms from URIs to allow transformation of the canonical ampersand delimited format to any other format - like rewrite rules on the client side as well as on the server side?
@Chris,
>> are all conceptually function calls with 2 parameters, and only the syntax is different.
Yes, but I do believe it's worth the effort to treat them differently, primarily because the path is such an understood -- and therefore powerful -- way to describe hierarchy of any given system ontology. So by focusing on the path portion of the URI to describe -- for example -- the system resource you want to operate upon, you can then use the query string to pass parameters in the more easily grok'd property1=value1&property2=value2 format. Add TimBL's Matrix URI's to the mix and you have a concise, clear, and straight forward way to point at something of interest that you want to operate upon, pass it either a 1-to-1 set of parameter(s)=value(s) and/or a many-to-one set of parameter(s)=collection(s);of;values, and in return gain access to a clearly understood response in regards to what that response relates to within a given system ontology.
Powerful stuff! This is why I have felt as strongly as I have about AtomPubSub > So much power exists in such simple constructs, and that power can be applied in so many different ways to a variety of backend systems that in many ways have no relation to one another yet still can interop with any given client using the same generalized interface that all the other services are using. MSFT has proven as of late that they truly understand the power sitting in front of them, embracing AtomPubSub wholeheartedly in nearly every single web facing project they have out there. Take a look at Dare Obasanjo's recent "Not Turtles, AtomPub All The Way Down"[1] post for more info.
>> There is tension between more abstract formats which don't expose the underlying implementation, decoupled via server-side rewrite rules, and self-describing formats. Indeed, the path style surely needs more documenting not less?
I don't think so. As long as the ontology of the system has been well designed and adequately described via the path, a lot of inferred documentation can take the place of explicit documentation. Of course, I think it would *GREAT* if we could adopt something as simple as,
~/foo/bar/baz//doc
... or ...
~/foo/bar/baz:doc
... as an easily understood way to gain access to operation specific documentation that relates to the described entity, both human readable as well as machine readable which is where the idea of using a lingua franca forms description language comes into play. Of course, in many ways, WSDL does this same generalized thing. Just in a slightly more complex way. So these ideas are really not anything new. Just honed a bit.
>> So I really like David's notion of a generic mechanism decoupling HTML forms from URIs to allow transformation of the canonical ampersand delimited format to any other format -
Thanks! But again, these are really just adaptations of existing ideas.
>> like rewrite rules on the client side as well as on the server side?
Sure, that would be one way to look at it, though with a well designed path-based system ontology, those rewrite rules can really be thought of in terms that are much less abstract and much more concrete as far as the translation from what-is-said/to/what-is-meant is concerned.
What do you think?
[1] http://www.25hoursaday.com/weblog/default.aspx#a02048ab4-a555-461c-9a23-a1dd4b1462c9
There's an interesting WADL generator (and code handler generator) at http://tomayac.de/rest-describe/latest/RestDescribe.html#
See it in action in this Google Tech Talk: http://www.youtube.com/watch?v=hZ2EtAEBpq0
Chris,
Something else to consider, and one of the reasons I'm taking this approach with x2o. I had run into much of the same discovery issues with my RESTful service that you're describing, and WADL just didn't seem to me to be the right approach.
It was about that time that I heard Joe Gregario talking about AtomPub (this was back at the 2007 OSCON conference) and the more he talked the more I realized that Atom(Pub) actually was the solution I was looking for. It abstracted out the publishing components and versioning information from the object representation itself (an XHTML document doesn't really need to know when it was created or what its about - that's external metadata that's more related to the publishing aspects of getting the content to the web).
Once you move your content to an AtomPub system, on the other hand, then you can take advantage of AtomPub introspection to extract various RESTful services, and then make use of regular schema tools such as XSD, RelaxNG or Schematron to perform the corresponding discovery or validation.
For instance, I have a RESTful service that I use to retrieve resume an XML representation of various objects, stored as feeds. For instance,
/atom/content/feeds/reports?/myreport
will retrieve the report as an XML obect with the alias "myreport" (the IDs are GUID numbers, so I use both an ID and an alias capability within my system) and
/atom/feed/feeds/reports?/myreport
will retrieve the same thing as an atom feed, while
/atom/schema/feeds/reports
will return the associated schema corresponding to the report objects. You can use Atom introspection to get both the available feeds and the respective services that support each feed type, along with the HTTP methods (GET,POST,PUT,DELETE or HEAD) that the services expose.
It may seem a little more complex, but the advantage to it is that you can then create multiple representations of the same abstract object simply by changing the service and HTTP method. You stay within a completely RESTful paradigm, and you bypass a lot of the headaches of "almost RESTful" architectures.
I'm hoping to have something up soon on Google Code about this, and will provide details at that point.