Original address: http://rest.elkstein.org/
Learn rest: a tutorial
WSDL (Web Services Description Language)Which is proposed by W3C and is usually used by the SOAP server to describe the services it can provide. The Service binding options of WSDL are flexible (for example, services can be provided through the SMTP Mail Server), except for get and post, HTTP operations are not supported. Since the rest service usually uses HTTP actions, such as put and delete, it is obviously inappropriate to select WSDL as the document description of the rest service.
In version 2.0, WSDL supports all HTTP actions. Therefore, it can be considered as a document description of the rest service.
The second option is wadl (Web application Description Language ). Wadl is dominated by Sun and similar to rest. wadl is lightweight, easy to understand, and easier to write. In some respects, wadl is not flexible in WSDL (not bound to the SMTP service), but it is sufficient for rest and has fewer actions.
The following is a segment of wadl describing Amazon's "iten serch" service:
<Method name = "get" id = "itemsearch"> <request> <Param name = "service" style = "query" fixed = "awsecommerceservice"/> <Param name =" version "style =" query "fixed =" 2005-07-26 "/> <Param name =" operation "style =" query "fixed =" itemsearch "/> <Param name =" subscriptionid" style = "query" type = "XSD: string "required =" true "/> <Param name =" searchindex "style =" query "type =" AWS: searchindextype "required =" true "> <option value =" books "/> <option value =" DVD "/> <option value =" Music "/> </param> <param name = "keywords" style = "query" type = "AWS: keywordlist "required =" true "/> <Param name =" responsegroup "style =" query "type =" AWS: responsegrouptype "repeating =" true "> <option value =" small "/> <option value =" medium "/> <option value =" large "/> <option value =" images "/> </param> </request> <response> <representation mediatype =" text/XML "element =" AWS: itemsearchresponse "/> </response> </method>
As we can see, most of the formats are obscure. the type-safe XMLSCHEMA type enriches rest.
- The length of the entire document is onlyCodeThere are about 10 lines of fragments (including XML Naming rules and Schema syntax reference). You can see in wadl specifications.
- Click W3C unicorn project specifications to view the wadl document of the CSS validator service.
Some rest advocates, however, find even the lightweight wadl to be an overkill. And indeed, most rest services are already ented by no more than a textual description (a human-readable HTML file ).
Some rest advocates find that lightweight wadl is sufficient. In fact, most rest service documents are text descriptions (human-readable HTML files ).