Skip to content
Sergii Kabashniuk edited this page Mar 18, 2015 · 1 revision

WADL support

Web Application Description Language (WADL)

The Web Application Description Language (WADL) is an XML-based file format that provides a machine-readable description of RESTful web applications.

EverRest generates WADL as response for OPTIONS request. It does not minds you need create method that annotated as @OPTIONS. If you not create such method in you service EverRest will create virtual method for you.

Lets try to see what will be generated as response for book service. You can download project from everrest subversion repository. It is located in everrest/everrest-samples/book-service. After download go to sub-project folder and run command: mvn jetty:run. When Jetty server starts open other console and run following command:

curl -X OPTIONS \
http://localhost:8080/book-service/books

As result you should get XML response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://research.sun.com/wadl/2006/10">
   <resources base="http://localhost:8080/book-service">
      <resource path="books">
         <method name="GET" id="getAll">
            <response>
               <representation mediaType="application/json" />
            </response>
         </method>
         <method name="OPTIONS">
            <response>
               <representation mediaType="application/vnd.sun.wadl+xml" />
            </response>
         </method>
         <method name="PUT" id="put">
            <request>
               <representation mediaType="application/json" />
            </request>
            <response>
               <representation mediaType="**/**" />
            </response>
         </method>
         <resource path="{id}">
            <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="id" />
            <method name="GET" id="get">
               <response>
                  <representation mediaType="application/json" />
               </response>
            </method>
         </resource>
      </resource>
   </resources>
</application>

Such XML description of service may be used to generate client side source code. You can read how to do it and download tool here.