Describing links in WADL

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Describing links in WADL

Marc Hadley

A number of folks have pointed out that it would be useful to be able  
to describe the linkages between described resources in addition to  
the HTTP methods that can be applied to those resources and the  
representation formats supported. Whilst it would be possible at  
runtime to compare a URI with the URIs of all of the resources in a  
description to identify a match, I think it would be preferable to be  
able to specify the resource targeted by a link up front where that  
information is known.

This can be achieved in WADL by adding a new element to the language:  
<link>. The <link> element can be used as a child of the existing  
<representation_variable> element and is used to indicate that the  
value of a representation component is a link to a described  
resource. The <link> element is syntactically similar to the HTML  
<link> element but differs semantically in that its href attribute  
identifies a <resource> element rather than a linked document. The  
parent <representation_variable> element identifies that part of the  
representation that contains the link. E.g.

If an application consists of the resources:{widgetid} (where {widgetid} is a variable  
component to the URI)

and a GET on the first resource gets me a WidgetList:

<eg:WidgetList xmlns:eg="...">
   <eg:Widget uri=""/>
   <eg:Widget uri=""/>

such that eg:Widget/@uri links to one of the " 
widgets/{widgetid}" resources, then this can be described as follows:

<application xmlns:...>

   <resources base="">
     <resource uri="widgets">
       <method href="#widgetList"/>
       <resource id="widgetResource" uri="{widgetid}">

   <method name="GET" id="widgetList">
       <representation mediaType="application/xml"  
         <representation_variable path="/Widgets/Widget/@uri"  
           <link href="#widgetResource" rel="child" rev="index"/>


The values of the rel and rev attributes are an open set including  
those used by convention in HTML. Similar to HTML, a profile  
attribute may be added to the application element to define a  
namespace for additional link types.

Thoughts, comments ?

Marc Hadley <marc.hadley at>
Business Alliances, CTO Office, Sun Microsystems.