The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


mhadley's Blog

WADL Submitted to W3C

Posted by mhadley on October 23, 2009 at 2:05 PM PDT

For those of you who've been patiently waiting for WADL to be submitted to a standards organization, I'm pleased to announce that WADL is now a W3C Member Submission.

The specification submitted to the W3C is a reformatted version of the draft update I blogged about here. If you already switched to that version then you are current. If not, now would be a good time to think about updating to the latest grammar, the changes are fairly minimal but did require a new namespace since they were not backwards compatible.

Related Topics >> Blogs      Java Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

HATEOAS with WADL

Posted by mhadley on April 2, 2009 at 9:17 AM PDT

Craig asked me how you would describe something like the Sun Cloud APIs with WADL and I thought others might be interested in the answer. A key feature of the cloud APIs is that they make good use of hypertext as the engine of application state or HATEOAS for (relatively) short. What this means is that rather than documenting a set of URIs and URI templates and relying on the client to construct URIs to access the resource they need, the cloud APIs only publish a single "root" URI and then document where to find additional URIs in representations that clients can use to traverse the service. This is much closer to how a browser user traverses links in web pages. In a recent blog entry Craig describes the advantages of HATEOAS.

So, how to describe this kind of Web application in WADL ? The key is to:

  1. Use resource types to describe each kind of resource,
  2. Parameterize representations to identify links embedded within them,
  3. Define the types of resource each embedded link identifies.

To illustrate I'll use the Sun cloud APIs and the root level representation of the VDC. In WADL we describe this top level resource as follows:

<resources base="http://example.com/">
  <resource path="/" type="#vdc"/>
</resources>

The above declares a top level resource of type "vdc" at the URI "http://example.com/". Next we need to describe the resource type "vdc":

<resource_type id="vdc">
  <method name="GET">
    <response status="200">
      <representation mediaType="application/vnd.com.sun.cloud.compute.Vdc+json">
        <parameter name="attach" path="vms[].attach" style="plain">
          <link resource_type="#button"/>
        </parameter>
        <parameter name="detach" path="vms[].detach" style="plain">
          <link resource_type="#button"/>
        </parameter>
        <parameter name="backup" path="vms[].backup" style="plain">
          <link resource_type="#button"/>
        </parameter>
        ...
      </representation>
    </response>
  </method>
</resource_type>

The above says that a representation of resources of type "vdc" can be obtained with GET and that such representations contain links to other types of resources. I've shown three links here but in reality a VDC document contains many more. Each link is contained within a parameter that describes where in the representation the link can be found. In this case each link is to the same type of resource that essentially acts like a push button, here's the description of that resource type:

<resource_type id="button">
  <method name="POST">
    <response status="204">
  </method>
</resource_type>

The above says that resources of type "button" only support POST and return an empty 204 response on success.

I've glossed over one important issue related to the use of JSON for the representation of a VDC. If the representation used XML then the value of the path attribute of the parameter element is an XPath and it has semantics for selecting a set of nodes. For JSON theres no such standard path language (that I'm aware of) so I've had to improvise. The "vms" property of the vdc JSON object is an array and the "[]" in the path attribute values is meant to signify that the path will match multiple properties of the JSON object, if anyone has a better idea then let me know.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

Hi Marc I am new to REST and WADL stuff and I started using jersey for one of my projects. (jersey-1.1.1.ea-snapshot) I came across lot of articles on wadl particulary using yahoo search api as an example. I understood how to generate client stubs using wadl and wadl2java. But I am not able to understand how an WebApplicationException gets converted to fault element in WADL? For e.g, I have a very simple resource namely Project and it throws EntityNotFoundException (a subclass of WebApplication) . what is the process involved in representing this exception as a fault element in WADL? I took the following steps: Created the Resource 'Project' Created the Exception 'EntityNotFoundException' (subclass of WAE) Used schemagen to generate corresponding xsd's Used wadl-generator to generate wadl from those xsds. However the generated wadl does not contain fault elements like the ones in yahoo search API. Could you please help me figure how to create those fault elements in wadl ? is it a manual process? Thanks in advance

Hello Marc. I've been researching on WADL lately, and it's been a great experience. However, recently I've got a doubt on the definition of the method element. The WADL specification says the following (p.9): "id: An identifier for the method, required for globally defined methods, not allowed on locally embedded methods". It doesn't make too much sense to me, because the section 2.7.2 talks about the method definition element, which is a child of a resource element. It means that this method is always a locally embedded one. The section 2.7.1 is the one talking about the method reference element, which is the global one. Could you please help me out here? Thanks! Otavio

A method definition element can either be a child of a resource element (a local definition) or a child of the application element (a global definition), sorry if that isn't clear from the spec. You should only include id attributes on global definitions to avoid the issue about how/whether to inherit resource-wide parameters in referenced methods.

RESTful Semantic Web Services

Hello Marc. I've just finished my masters thesis on RESTful Semantic Web Services. One of my findings is that WADL can be successfully applied on Semantic Web Services. I would love to receive some feedback from you! http://www.fullsemanticweb.com/blog/ontologies/restfulgrounding/ Thank you very much in advance. Cheers!

HATEOAS with WADL

Posted by mhadley on April 2, 2009 at 9:17 AM PDT

Craig asked me how you would describe something like the Sun Cloud APIs with WADL and I thought others might be interested in the answer. A key feature of the cloud APIs is that they make good use of hypertext as the engine of application state or HATEOAS for (relatively) short. What this means is that rather than documenting a set of URIs and URI templates and relying on the client to construct URIs to access the resource they need, the cloud APIs only publish a single "root" URI and then document where to find additional URIs in representations that clients can use to traverse the service. This is much closer to how a browser user traverses links in web pages. In a recent blog entry Craig describes the advantages of HATEOAS.

So, how to describe this kind of Web application in WADL ? The key is to:

  1. Use resource types to describe each kind of resource,
  2. Parameterize representations to identify links embedded within them,
  3. Define the types of resource each embedded link identifies.

To illustrate I'll use the Sun cloud APIs and the root level representation of the VDC. In WADL we describe this top level resource as follows:

<resources base="http://example.com/">
  <resource path="/" type="#vdc"/>
</resources>

The above declares a top level resource of type "vdc" at the URI "http://example.com/". Next we need to describe the resource type "vdc":

<resource_type id="vdc">
  <method name="GET">
    <response status="200">
      <representation mediaType="application/vnd.com.sun.cloud.compute.Vdc+json">
        <parameter name="attach" path="vms[].attach" style="plain">
          <link resource_type="#button"/>
        </parameter>
        <parameter name="detach" path="vms[].detach" style="plain">
          <link resource_type="#button"/>
        </parameter>
        <parameter name="backup" path="vms[].backup" style="plain">
          <link resource_type="#button"/>
        </parameter>
        ...
      </representation>
    </response>
  </method>
</resource_type>

The above says that a representation of resources of type "vdc" can be obtained with GET and that such representations contain links to other types of resources. I've shown three links here but in reality a VDC document contains many more. Each link is contained within a parameter that describes where in the representation the link can be found. In this case each link is to the same type of resource that essentially acts like a push button, here's the description of that resource type:

<resource_type id="button">
  <method name="POST">
    <response status="204">
  </method>
</resource_type>

The above says that resources of type "button" only support POST and return an empty 204 response on success.

I've glossed over one important issue related to the use of JSON for the representation of a VDC. If the representation used XML then the value of the path attribute of the parameter element is an XPath and it has semantics for selecting a set of nodes. For JSON theres no such standard path language (that I'm aware of) so I've had to improvise. The "vms" property of the vdc JSON object is an array and the "[]" in the path attribute values is meant to signify that the path will match multiple properties of the JSON object, if anyone has a better idea then let me know.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

Hi Marc I am new to REST and WADL stuff and I started using jersey for one of my projects. (jersey-1.1.1.ea-snapshot) I came across lot of articles on wadl particulary using yahoo search api as an example. I understood how to generate client stubs using wadl and wadl2java. But I am not able to understand how an WebApplicationException gets converted to fault element in WADL? For e.g, I have a very simple resource namely Project and it throws EntityNotFoundException (a subclass of WebApplication) . what is the process involved in representing this exception as a fault element in WADL? I took the following steps: Created the Resource 'Project' Created the Exception 'EntityNotFoundException' (subclass of WAE) Used schemagen to generate corresponding xsd's Used wadl-generator to generate wadl from those xsds. However the generated wadl does not contain fault elements like the ones in yahoo search API. Could you please help me figure how to create those fault elements in wadl ? is it a manual process? Thanks in advance

Hello Marc. I've been researching on WADL lately, and it's been a great experience. However, recently I've got a doubt on the definition of the method element. The WADL specification says the following (p.9): "id: An identifier for the method, required for globally defined methods, not allowed on locally embedded methods". It doesn't make too much sense to me, because the section 2.7.2 talks about the method definition element, which is a child of a resource element. It means that this method is always a locally embedded one. The section 2.7.1 is the one talking about the method reference element, which is the global one. Could you please help me out here? Thanks! Otavio

A method definition element can either be a child of a resource element (a local definition) or a child of the application element (a global definition), sorry if that isn't clear from the spec. You should only include id attributes on global definitions to avoid the issue about how/whether to inherit resource-wide parameters in referenced methods.

RESTful Semantic Web Services

Hello Marc. I've just finished my masters thesis on RESTful Semantic Web Services. One of my findings is that WADL can be successfully applied on Semantic Web Services. I would love to receive some feedback from you! http://www.fullsemanticweb.com/blog/ontologies/restfulgrounding/ Thank you very much in advance. Cheers!

JAX-RS 1.1 Draft Available

Posted by mhadley on March 13, 2009 at 9:27 AM PDT

A draft of the JAX-RS 1.1 specification and API is now available. We're now working on implementing the new features in Jersey and adding corresponding tests to the TCK. It will be a while before 1.1 can be declared final since there's quite a bit of new functionality, particularly in the areas of integration with Servlet 3.0, EJB 3.1 and JSR 299 - none of which are yet final.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

JAX-RS 1.1 Draft Available

Posted by mhadley on March 13, 2009 at 9:27 AM PDT

A draft of the JAX-RS 1.1 specification and API is now available. We're now working on implementing the new features in Jersey and adding corresponding tests to the TCK. It will be a while before 1.1 can be declared final since there's quite a bit of new functionality, particularly in the areas of integration with Servlet 3.0, EJB 3.1 and JSR 299 - none of which are yet final.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

BYOAPI to Zembly with WADL

Posted by mhadley on March 4, 2009 at 8:34 AM PST

Check out this tutorial on the use of WADL to add a service to Zembly. For those not already familiar with Zembly it is:

"An application development environment that not only targets the web as its native platform, but uses cutting-edge web innovations such as web services, social networking, and Web 2.0, to change the way applications are built, deployed, scaled, and delivered to where users congregate."

Essentially any service described by WADL can be easily used within a Zembly application. If you are using Jersey to build your service then support for WADL comes free.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

BYOAPI to Zembly with WADL

Posted by mhadley on March 4, 2009 at 8:34 AM PST

Check out this tutorial on the use of WADL to add a service to Zembly. For those not already familiar with Zembly it is:

"An application development environment that not only targets the web as its native platform, but uses cutting-edge web innovations such as web services, social networking, and Web 2.0, to change the way applications are built, deployed, scaled, and delivered to where users congregate."

Essentially any service described by WADL can be easily used within a Zembly application. If you are using Jersey to build your service then support for WADL comes free.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

Draft WADL Update

Posted by mhadley on February 3, 2009 at 8:38 AM PST

Its been just over two years since the last version of WADL was published and, in the intervening time, a number of issues have accumulated. I've held off making regular updates for reasons of stability but I think there's sufficient backlog now to require a new version. First drafts of the updated specification and schemas are available at:

Changes since the November 2006 Publication:

  • The XML namespace name was changed to http://wadl.dev.java.net/2009/02.
  • Resolved issue 13. The status attribute was moved from the representation element to the response element. The cardinality of the response element was changed from 0–1 to 0–many. The fault element was removed.
  • Resolved issue 17. Allow parameters at top level and parameter references to prevent repetition when a parameter is used in multiple places.
  • Resolved issue 18. A resource type element may now contain resource child elements.
  • Resolved issue 20. Allow multiple resources elements within an application.
  • Updated the Atompub example to RFC syntax.

Unfortunately the changes required by issue 13 are not backwards compatible hence the namespace change. Existing WADL docs will require minor edits as a result.

All feedback on the new draft is welcome. Now would be a good time to file bug reports or request enhancements.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

Draft WADL Update

Posted by mhadley on February 3, 2009 at 8:38 AM PST

Its been just over two years since the last version of WADL was published and, in the intervening time, a number of issues have accumulated. I've held off making regular updates for reasons of stability but I think there's sufficient backlog now to require a new version. First drafts of the updated specification and schemas are available at:

Changes since the November 2006 Publication:

  • The XML namespace name was changed to http://wadl.dev.java.net/2009/02.
  • Resolved issue 13. The status attribute was moved from the representation element to the response element. The cardinality of the response element was changed from 0–1 to 0–many. The fault element was removed.
  • Resolved issue 17. Allow parameters at top level and parameter references to prevent repetition when a parameter is used in multiple places.
  • Resolved issue 18. A resource type element may now contain resource child elements.
  • Resolved issue 20. Allow multiple resources elements within an application.
  • Updated the Atompub example to RFC syntax.

Unfortunately the changes required by issue 13 are not backwards compatible hence the namespace change. Existing WADL docs will require minor edits as a result.

All feedback on the new draft is welcome. Now would be a good time to file bug reports or request enhancements.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

JAX-RS Proposed Final Draft

Posted by mhadley on August 18, 2008 at 12:40 PM PDT

The proposed final draft of JAX-RS is now available for review. We are now concentrating on completing the reference implementation (Jersey) and the TCK for a planned final 1.0 release in September.

Related Topics >> Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)

Nice. I've been very happy with Jersey so far. You and Paul keep up the good work.