Let’s have a detailed look at how soapUI models REST Services in soapUI. Start by creating a new project and specifying the sample WADL available at http://www.soapui.org/samples/wadl/YahooSearch.wadl:

After pressing OK, soapUI creates the specified project and imports the WADL, resulting in the following object hierarchy in the navigator:

Here you can see the core items that make up a REST Services:
- The REST Service itself (“YahooTest”)
- Its only resource (“Yahoo News Search Service” ), available on the path “/NewsSearchService/V1/newsSearch”
- The defined GET method for accessing the resource (“Search news stories by keyword”)
- A default request generated by soapUI for this method (“Request 1”)
Before digging into the Resource/Method/Request objects, let’s first look more at the service; double-click the REST Service node which opens the following window:

The Overview tab shows basic data about the service. The Service Endpoints tab lets you define any number of alternative endpoints for your service, which you can easily switch between in the REST Request editor:

Let’s head straight for the WADL Content Tab:

To the right you can see separate tabs for each of the files imported for the WADL, in our case the WADL itself and two XML Schema files, one defining the response message format and one define the error message format. The tree to the left allows for easy navigation between elements in all imported files, for example selecting the GET method as in the screenshot above highlights it in the corresponding WADL file to the right.
Generating Documentation and Code
The toolbar at the top allows both for generation of documentation and for exporting the actual WADL to the local file system, which can be especially useful if the WADL has been generated by soapUI instead of imported (more on that below).
Pressing the documentation button prompts for an output folder and then generates the following and opens it in your system web browser:

Just as for WSDL-development frameworks, soapUI provides a graphical frontend for generating code for your WADL, right click on the Service node and select “WADL2Java”, which will open the following dialog:

Specify the output directory and destination package and make sure that the WADL2Java path is set in the global tools preferences:

Then press Generate which will invoke the command-line tool and show the execution process:

Now the generated classes can be imported into your favorite Java IDE and you’re all set to create mind-boggling REST applications.



