El lenguaje de descripción de aplicaciones web ( WADL ) es una descripción XML legible por máquina de servicios web basados en HTTP . [1] WADL modela los recursos proporcionados por un servicio y las relaciones entre ellos. [1] WADL tiene como objetivo simplificar la reutilización de servicios web que se basan en la arquitectura HTTP existente de la web. [1] [2] Es independiente de la plataforma y el idioma y tiene como objetivo promover la reutilización de aplicaciones más allá del uso básico en un navegador web. [1]
WADL fue presentado al Consorcio World Wide Web por Sun Microsystems el 31 de agosto de 2009 [1] , pero el consorcio no tiene planes actuales para estandarizarlo [2] . WADL es el RESTO equivalente de jabón 's Servicios Web de lenguaje de descripción (WSDL), que también puede ser usado para describir REST servicios web. [3]
Formato
El servicio se describe mediante un conjunto de elementos de recursos . Cada recurso contiene elementos param para describir las entradas y elementos del método que describen la solicitud y respuesta de un recurso. El elemento de solicitud especifica cómo representar la entrada, qué tipos se requieren y cualquier encabezado HTTP específico que se requiera. La respuesta describe la representación de la respuesta del servicio, así como cualquier información de falla, para hacer frente a los errores.
Ejemplo
La siguiente lista muestra un ejemplo de una descripción WADL para la aplicación Yahoo News Search.
ón> 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" > href = "NewsSearchResponse.xsd" /> href = "Error.xsd" /> base = "http://api.search.yahoo.com/NewsSearchService/V1/" > path = "newsSearch" > name = "GET" id = "search" > < nombre del parámetro = "appid" type = "xsd: string" style = "query" required = "true" /> name = "query" type = "xsd: string" style = "query" required = "true" /> < param name = "type" style = "query" default = "all" > value = "all" /> value = "any" /> value = "frase" /> name = "results" style = "query" type = "xsd: int" default = "10" /> name = "start" style = "query" type = "xsd: int" default = "1" /> name = "sort" style = "query" default = "rank" > value = "rank" /> value = "date" /> name = "language" style = " query " type = " xsd: string " /> status = " 200 " > mediaType = " application / xml " element = " yn: ResultSet " /> status = " 400 " > mediaType = " application / xml " element = " ya: Error " /> urces>
Genere WADL o genere código a partir de WADL
Java
Hay varias herramientas para generar código Java a partir de un WADL existente: [4] [5]
- Apache CXF
- API de Java para servicios web RESTful y su implementación de referencia, Jersey
Ejemplo WADL generado por CXF
xmlns = "http://research.sun.com/wadl/2006/10" xmlns: xs = "http://www.w3.org/2001/XMLSchema" > xmlns: xs = "http://www.w3.org/2001/XMLSchema" attributeFormDefault = " unqualified " elementFormDefault = " unqualified " > name = "appProfile" type = "appProfile" /> name = "customerProfile" type = "customerProfile" /> name = "customerProfile" > minOccurs = "0" name = "accessPaymentServicesEnabled" type = "xs: boolean" /> maxOccurs = "ilimitado" minOccurs = "0" nombre = "atributos" nillable = "true" tipo = "atributo" /> minOccurs = "0" nombre = "billingType" tipo = "xs: cadena" /> minOccurs = "0" name = "defaultCurrency" type = "xs: string" /> minOccurs = "0" name = "defaultSpendingLimitCurrency" type = "xs: string" /> minOccurs = "0" name = "maximumSpendingLimit" type = "xs: double" /> minOccurs = "0" name = "minimumSpendingLimit" type = "xs: double" /> minOccu rs = "0" name = "customerCategory" type = "xs: string" /> minOccurs = "0" name = "customerEnabled" type = "xs: boolean" /> minOccurs = "0 " name = " customerName " type = " xs: string " /> minOccurs = " 0 " name = " paymentNotificationEndpointAddress " type = " xs: string " /> minOccurs = " 0 " name = " pseCustomerId " type = " xs: string " /> minOccurs = " 0 " name = " resourceURL " type = " xs: string " /> minOccurs = " 0 " name = " settingContractUuid " type = "xs: string" /> minOccurs = "0" name = "isSpendingLimitEnabled" type = "xs: boolean" /> minOccurs = "0" name = "abcCustomerId" type = "xs: string " /> name = " attribute " > minOccurs = " 0 " name = " key " type = " xs: string " /> minOccurs = " 0 " name = " value " type = " xs: string " /> name = " appProfile " > minOccurs = "0" nombre = "appEnabled" tipo = "xs: b oolean " /> minOccurs = " 0 " name = " appName " type = " xs: string " /> minOccurs = " 0 " name = " appPassword " type = " xs: string " /> minOccurs = "0" name = "appUserName" type = "xs: string" /> minOccurs = "0" name = "appUuid" type = "xs: string" /> maxOccurs = "ilimitado" minOccurs = "0" nombre = "atributos" nillable = "true" tipo = "atributo" /> minOccurs = "0" nombre = "descripción" tipo = "xs: cadena" /> minOccurs = "0" name = "customerName" type = "xs: string" /> minOccurs = "0" name = "resourceURL" type = "xs: string" /> minOccurs = "0" name = "serviceContractName" type = "xs: string" /> minOccurs = "0" name = "abcAppId" type = "xs: string" /> base = "http: // mpsamara-mobl-vm1: 9078 / customermanagement / v1" > path = "/ customers" > path = " / " > étodo> nombre = " BORRAR " > mediaType = " app / json " /> name = " GET " > name = " page " style = " query " type = " xs: int " /> name = " partialCustomerName " style = " query " type = " xs: string " /> mediaType = " app / json " /> name = " POST " > < solicitud> mediaType = "app / json" /> mediaType = "app / json" /> name = "PUT" > mediaType = "app / json" /> path = "/ {customerUserName}" > name = "DELETE" > < request> mediaType = "app / json" /> path = "/ {customerUserName}" > name = "customerUserName" style = "template" type = "xs: string" /> name = "GET" > mediaType = "app / json" /> < nombre del método = "POST" > ation mediaType = "app / json" /> mediaType = "app / json" /> path = "/ {customerUserName}" > name = "PUT" > mediaType = "app / json" /> path = "/ {customerUserName } / apps " > name = " DELETE " > mediaType = " app / json " /> path = "/ {customerUserName} / apps" > name = "customerUserName" style = "template" type = "xs: string" /> name = "GET" > name = "page" style = "query" type = "xs: int" /> mediaType = "app / json" /> name = "POST" > < representacion mediaType = "app / json" /> mediaType = "app / json" /> path = "/ {customerUserName} / aplicaciones " > < nombre del método = " PUT " > uest> mediaType = "app / json" /> path = "/ {customerUserName} / apps / {appName}" > < method name = "DELETE" > mediaType = "app / json" /> path = "/ {customerUserName} / apps / {appName} " > name = " customerUserName " style = " template " type = " xs: string " /> name = " appName " style = " template " type = " xs: string " /> < method name = "GET" > mediaType = "app / json" /> name = "POST" > mediaType = "app / json" /> mediaType = "app / json" /> path = "/ {customerUserName} / apps / {appName} " > name = " PUT " > mediaType = " app / json " />
Ver también
Referencias
- ↑ a b c d e Sun Microsystems (31 de agosto de 2009). "Lenguaje de descripción de la aplicación web: envío de miembros del W3C el 31 de agosto de 2009" . Consorcio World Wide Web . Consultado el 12 de agosto de 2012 .
- ^ a b Consorcio World Wide Web (14 de octubre de 2009). "Comentario del equipo sobre el envío de" Lenguaje de descripción de la aplicación web " . Consorcio World Wide Web . Consultado el 12 de agosto de 2012 .
- ^ Lawrence Mandel (29 de mayo de 2008). "Describir los servicios web REST con WSDL 2.0: una guía práctica" . IBM . Consultado el 12 de agosto de 2012 .
- ^ proyecto github WADL
- ^ Apache CXF
enlaces externos
- Página de inicio de WADL en github
- Especificación actual para WADL