Web Application Description Language
The Web Application Description Language (WADL) is a machine-readable XML description of HTTP-based web services.[1] WADL models the resources provided by a service and the relationships between them.[1] WADL is intended to simplify the reuse of web services that are based on the existing HTTP architecture of the Web.[1][2] It is platform and language independent and aims to promote reuse of applications beyond the basic use in a web browser.[1]
WADL was submitted to the World Wide Web Consortium by Sun Microsystems on 31 August 2009[1], but the consortium has no current plans to standardize it[2]. WADL is the REST equivalent of SOAP's Web Services Description Language (WSDL), which can also be used to describe REST web services.[3]
Format
The service is described using a set of resource elements. Each resource contains param elements to describe the inputs, and method elements which describe the request and response of a resource. The request element specifies how to represent the input, what types are required and any specific HTTP headers that are required. The response describes the representation of the service's response, as well as any fault information, to deal with errors.
Example
The following listing shows an example of a WADL description for the Yahoo News Search application.
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://wadl.dev.java.net/2009/02 wadl.xsd"
xmlns:tns="urn:yahoo:yn"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:yn="urn:yahoo:yn"
xmlns:ya="urn:yahoo:api"
xmlns="http://wadl.dev.java.net/2009/02">
<grammars>
<include
href="NewsSearchResponse.xsd"/>
<include
href="Error.xsd"/>
</grammars>
<resources base="http://api.search.yahoo.com/NewsSearchService/V1/">
<resource path="newsSearch">
<method name="GET" id="search">
<request>
<param name="appid" type="xsd:string"
style="query" required="true"/>
<param name="query" type="xsd:string"
style="query" required="true"/>
<param name="type" style="query" default="all">
<option value="all"/>
<option value="any"/>
<option value="phrase"/>
</param>
<param name="results" style="query" type="xsd:int" default="10"/>
<param name="start" style="query" type="xsd:int" default="1"/>
<param name="sort" style="query" default="rank">
<option value="rank"/>
<option value="date"/>
</param>
<param name="language" style="query" type="xsd:string"/>
</request>
<response status="200">
<representation mediaType="application/xml"
element="yn:ResultSet"/>
</response>
<response status="400">
<representation mediaType="application/xml"
element="ya:Error"/>
</response>
</method>
</resource>
</resources>
</application>
Generate WADL or generate code from WADL
Java
There are multiple tools to generate java code from an existing WADL:[4][5]
- Apache CXF
- Java API for RESTful Web Services, and its reference implementation, Jersey
See also
References
- 1 2 3 4 5 Sun Microsystems (31 August 2009). "Web Application Description Language: W3C Member Submission 31 August 2009". World Wide Web Consortium. Retrieved 12 August 2012.
- 1 2 World Wide Web Consortium (14 October 2009). "Team Comment on the "Web Application Description Language" Submission". World Wide Web Consortium. Retrieved 12 August 2012.
- ↑ Lawrence Mandel (29 May 2008). "Describe REST Web services with WSDL 2.0: A how-to guide". IBM. Retrieved 12 August 2012.
- ↑ java.net WADL project
- ↑ Apache CXF