Reference articles on history, science, culture and more
Encyclopedia

Web Application Description Language

Structured language for Web services

The Web Application Description Language (WADL) is a machine-readable XML description of HTTP-based web services. WADL models the resources provided by a service and the relationships between them. WADL is intended to simplify the reuse of web services that are based on the existing HTTP architecture of the Web. It is platform and language independent and aims to promote reuse of applications beyond the basic use in a web browser. WADL was submitted to the World Wide Web Consortium by Sun Microsystems on 31 August 2009, but the consortium has no current plans to standardize it. WADL is the REST equivalent of SOAP's Web Services Description Languages (WSDL), which can also be used to describe REST web services.

01Format

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.

02Example

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:yn="urn:yahoo:yn" xmlns:ya="urn:yahoo:api" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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>

03Generate WADL or generate code from WADL

Java

There are multiple tools to generate java code from an existing WADL:

Example WADL Generated by CXF

<app xmlns="http://research.sun.com/wadl/2006/10" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <grammars> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="unqualified"> <xs:element name="appProfile" type="appProfile"/> <xs:element name="customerProfile" type="customerProfile"/> <xs:complexType name="customerProfile"> <xs:sequence> <xs:element minOccurs="0" name="accessPaymentServicesEnabled" type="xs:boolean"/> <xs:element maxOccurs="unbounded" minOccurs="0" name="attributes" nillable="true" type="attribute"/> <xs:element minOccurs="0" name="billingType" type="xs:string"/> <xs:element minOccurs="0" name="defaultCurrency" type="xs:string"/> <xs:element minOccurs="0" name="defaultSpendingLimitCurrency" type="xs:string"/> <xs:element minOccurs="0" name="maximumSpendingLimit" type="xs:double"/> <xs:element minOccurs="0" name="minimumSpendingLimit" type="xs:double"/> <xs:element minOccurs="0" name="customerCategory" type="xs:string"/> <xs:element minOccurs="0" name="customerEnabled" type="xs:boolean"/> <xs:element minOccurs="0" name="customerName" type="xs:string"/> <xs:element minOccurs="0" name="paymentNotificationEndpointAddress" type="xs:string"/> <xs:element minOccurs="0" name="pseCustomerId" type="xs:string"/> <xs:element minOccurs="0" name="resourceURL" type="xs:string"/> <xs:element minOccurs="0" name="settlementContractUuid" type="xs:string"/> <xs:element minOccurs="0" name="isSpendingLimitEnabled" type="xs:boolean"/> <xs:element minOccurs="0" name="abcCustomerId" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="attribute"> <xs:sequence> <xs:element minOccurs="0" name="key" type="xs:string"/> <xs:element minOccurs="0" name="value" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="appProfile"> <xs:sequence> <xs:element minOccurs="0" name="appEnabled" type="xs:boolean"/> <xs:element minOccurs="0" name="appName" type="xs:string"/> <xs:element minOccurs="0" name="appPassword" type="xs:string"/> <xs:element minOccurs="0" name="appUserName" type="xs:string"/> <xs:element minOccurs="0" name="appUuid" type="xs:string"/> <xs:element maxOccurs="unbounded" minOccurs="0" name="attributes" nillable="true" type="attribute"/> <xs:element minOccurs="0" name="description" type="xs:string"/> <xs:element minOccurs="0" name="customerName" type="xs:string"/> <xs:element minOccurs="0" name="resourceURL" type="xs:string"/> <xs:element minOccurs="0" name="serviceContractName" type="xs:string"/> <xs:element minOccurs="0" name="abcAppId" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> </grammars> <resources base="http://mpsamara-mobl-vm1:9078/customermanagement/v1"> <resource path="/customers"> <resource path="/"> <method name="DELETE"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> <method name="GET"> <request> <param name="page" style="query" type="xs:int"/> <param name="partialCustomerName" style="query" type="xs:string"/> </request> <response> <representation mediaType="app/json"/> </response> </method> <method name="POST"> <request> <representation mediaType="app/json"/> </request> <response> <representation mediaType="app/json"/> </response> </method> <method name="PUT"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}"> <method name="DELETE"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}"> <param name="customerUserName" style="template" type="xs:string"/> <method name="GET"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> <method name="POST"> <request> <representation mediaType="app/json"/> </request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}"> <method name="PUT"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}/apps"> <method name="DELETE"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}/apps"> <param name="customerUserName" style="template" type="xs:string"/> <method name="GET"> <request> <param name="page" style="query" type="xs:int"/> </request> <response> <representation mediaType="app/json"/> </response> </method> <method name="POST"> <request> <representation mediaType="app/json"/> </request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}/apps"> <method name="PUT"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}/apps/{appName}"> <method name="DELETE"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}/apps/{appName}"> <param name="customerUserName" style="template" type="xs:string"/> <param name="appName" style="template" type="xs:string"/> <method name="GET"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> <method name="POST"> <request> <representation mediaType="app/json"/> </request> <response> <representation mediaType="app/json"/> </response> </method> </resource> <resource path="/{customerUserName}/apps/{appName}"> <method name="PUT"> <request></request> <response> <representation mediaType="app/json"/> </response> </method> </resource> </resource> </resources> </app>
Watch videos about Web Application Description LanguageExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article Web Application Description Language, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.