+

Search Tips   |   Advanced Search

Use WADL to generate service documentation

Web Application Description Language (WADL) is a description language for HTTP-based applications. It is currently a World Wide Web Consortium (W3C) Member Submission. WADL can be used by programs to give information about the service in a machine-processable method. For instance, we can use an Extensible Stylesheet Transformation (XSLT) document to transform the WADL documentation by using a custom XSLT and a XSLT processor.

By default, a WADL document can be requested for a particular resource by invoking an HTTP OPTIONS request for any Java API for RESTful Web Services (JAX-RS) URL. We can issue an OPTIONS request with most HTTP clients. The WADL document returned from the request describes the resource using information from the JAX-RS annotations.

WADL is a developing standard which helps describe the services available to users. WADL documents are written in XML. Using XSTL or XML parsers, developers can generate documentation for the service. In some cases, users may develop clients to dynamically understand the RESTful service by inspecting the WADL document.

Use IBM JAX-RS, developers can generate a JAXB XML representation of a WADL document describing all of the resources available in the application. The JAXB representation can be returned from a JAX-RS resource method. Then, the WADL document resource is treated like any other JAX-RS resource and can be used by clients.

  1. Configure the development environment.

  2. Define resources in JAX-RS web applications.

  3. Configure the JAX-RS application.

  4. Use WADL to generate service documentation.

  5. Assemble JAX-RS web applications.

  6. Deploy JAX-RS web applications.


Results

You have added a WADL service document to the application to enable clients to retrieve a representation of the service. By default, we can also issue OPTIONS requests to the resources to retrieve a WADL representation of the individual resource. If we have chosen to do so, we can disable the automatic generation of a WADL document for OPTIONS requests.


Subtopics

  • Web services specifications and APIs