Web Application Description Language

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

The Web Application Description Language (WADL) is a machine-readable XML description of HTTP-based web services.[1]:{{{3}}} WADL models the resources provided by a service and the relationships between them.[1]:{{{3}}} WADL is intended to simplify the reuse of web services that are based on the existing HTTP architecture of the Web.[1]:{{{3}}}[2]:{{{3}}} It is platform and language independent and aims to promote reuse of applications beyond the basic use in a web browser.[1]:{{{3}}}

WADL was submitted to the World Wide Web Consortium by Sun Microsystems on 31 August 2009[1]:{{{3}}}, but the consortium has no current plans to standardize it[2]:{{{3}}}. WADL is the REST equivalent of SOAP's Web Services Description Language (WSDL), which can also be used to describe REST web services.[3]:{{{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]

See also

References

  1. 1.0 1.1 1.2 1.3 1.4 Lua error in package.lua at line 80: module 'strict' not found.
  2. 2.0 2.1 Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. java.net WADL project
  5. Apache CXF

External links