Service Properties and Action
Once created, the REST Service has the following properties in the bottom left:
- Name - the name of the REST Service
- Description - a short description of the service
- Base Path - the base path to prefix to all resource paths when sending requests
- WADL - the URL to the originally imported WADL (if available)
- Generated - true if the WADL has been generated instead of imported
Right-click a REST Service in the navigator opens a pop up with the following actions:
- Show Service Viewer - Opens the Service Viewer described below
- Generate TestSuite - Opens a dialog for generating a TestSuite for the service (see below)
- Create Documentation - Prompts to generate HTML documentation for the REST Service which will be opened in an external browser
- WADL2Java - Prompts to run the Wadl2Java tool for generating java classes for the services WADL (see below)
- Export WADL - Prompts to export the WADL and included schema to the file system
- New Resource - Prompts to create a new Resource in this service
- Delete - Prompts to delete this service
- Online Help - Opens this page in an external browser
REST Service Viewer
Double-clicking a REST Service opens the REST Service Viewer which is basically layed out as the corresponding WSDL Interface viewer:
- An "Overview" tab showing basic information about the WADL
- A "Service Endpoints" tab allowing for management of service endpoints and default authentication settings.
- A "WADL Content" tab displaying the WADL and its references XML-Schemas.
The toolbar for this tab contains the following actions (left to right):
- Back - navigates back in the content tree
- Forward - navigates forward in the content tree
- Generate Documentation - prompts to generate HTML documentation for this WADL
- Export WADL - prompts to export the WADL and referenced schemas to a local folder
- Recreate WADL (not shown in screenshot) - for generated WADLs, regenerates the WADL from the defined REST artifacts.
Generate TestSuite
The "Generate TestSuite" option on the REST Service popup opens the following dialog:
The options available are:
- TestSuite : target TestSuite or option to create a new one
- Style : how to generate TestCases
- Resources : a "flattened" list of all resources in the Service
- Generate LoadTest : if a default LoadTest is to be created for each generated TestCase
Pressing OK will generate one REST RequestStep for each selected Resource, either all in one TestCase or in one TestCase for each.
WADL2Java Integration
soapUI integrates with the wadl2Java tool included in the WADL toolkit allowing one to generate java code from both imported and generated WADLs. Selecting the WADL2Java option on the REST Service popup opens the following dialog:
The options in the dialog correspond to those for the tool, once the path to wadl2java has been set in the global tool integration settings and the dialog has been configured as desired, pressing OK will launch the tool to generate the corresponding Java classes:
REST Parameters
Parameters can be defined on both resource/child-resource and method level and are managed via a parameters table in the corresponding Resource/Method editors:
The toolbar at the top of the table has the following actions: (left to right)
Add - adds a new parameter
Delete - prompts to delete the selected parameter
Clear - clears all current parameter values
Move Down - moves the selected parameter down one row in the table
Move Up - moves the selected parameter up one row in the table
Update from URL - prompts for an endpoint and adds/extracts corresponding parameters
Depending on a parameters Style in the above table, its value will be added to an outgoing request in different ways:
QUERY : added to the query string of the target URL upon submitting
HEADER : added as an HTTP Header to the outgoing request
TEMPLATE : replaces the corresponding {} placeholder in the URL path upon submitting
MATRIX : appends corresponding ";:" pairs to the URL path (before the query string) on submitting. If the parameter is defined as a Boolean, only the parameter name is added when its value is set to "true".
When editing a Request, the following table is used, allowing you to change the values of existing parameters, defined at the Method and Resource levels.
The toolbar at the top of the table has the following actions: (left to right)
Defaults - restores the default values for each parameter
Clear - clears all current parameter values
Update from URL - prompts for an endpoint and adds/extracts corresponding parameter values
Furthermore, each parameter has a number of detailed settings that can be accessed via the "Details" tab below the parameter table in the Resource and Method views;
The settings are as follows:
Required : if the parameter is required to have a value
Default : the default value to use
Type : the XML Schema Type of the parameter value
Options : a list of possible parameter values
Description : a descriptive text for the parameter
Disable Encoding : disables URL-Encoding of the parameter value when it is sent
These settings mainly affect two behaviours in soapUI:
1. The generated WADL which contains all but the last setting
2. The input field generated in the ReadyAPI Form Editor for the parameter:
As you can see above the generated form contains drop-downs, type-information, etc as configured for each parameter.
New REST Resource
When choosing a new REST Resource, the following dialog will be displayed:
The dialog has the following options:
Resource Name : the name of the resource
Resource Path/Endpoint : a path or complete endpoint for the resource
Extract Params : select this option to extract parameters/path information from the specified endpoint/path.
Parameters : a table containing extracted or manually added parameters.
Create Request : option to create a default request for the resource. This also creates a Method in-between the Resource and Request.
The Extract Params button will parse the specified endpoint and try to extract query, matrix and template parameters from it. Also a host name will be removed and a path components corresponding to the REST Services Base Path and containing Resources' path will be removed. For example specifying
http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Madonna&output=xml
and pressing the Extract button will result in
As you can see, the host has been removed and query parameters have been extracted.
Properties and Actions
The following properties are available at the bottom left for a REST Resource:
- Name : the name of the resource
- Description : a short description
- Path : the path of the resource relative to parent resource/service
Right-clicking a resource shows a popup with the following actions:
- Show Resource Viewer - opens the Resource Viewer (see below)
- New Request - prompts to create a new Request for this Resource
- New Child Resource - prompts to create a new child Resource to this Resource using the above described dialog
- Clone Resource - prompts to clone this Resource including all Requests and children
- Rename - prompts to rename the Resource
- Delete - prompts to delete the Resource
- Online Help - shows this page in a browser
REST Resource Viewer
The REST Resource View is as follows:
The toolbar at the top contains an action to create a new request for this Resource together with a text field to edit the path of the Resource. The "Resource Parameters" tab contains all parameters for this resource as described in Parameters and Representation
REST Method Viewer
The REST Method View is as follows:
The toolbar at the top contains an action to create a new request for this Method together with a combo box to edit the HTTP method of the Method. The "Method Parameters" tab contains all parameters for this Method and the "Representations" tab contains all representations, both as described in Parameters and Representations
Properties and Actions
The following properties are available at the bottom left for a REST Method:
- Name : the name of the method
- Description : a short description
- HTTP Method : the HTTP Method to use by child requests
Right-clicking a resource shows a popup with the following actions:
- Show Method Viewer - opens the Method Viewer (see below)
- New Request - prompts to create a new Request for this Method
- Clone Method - prompts to clone this Method including all children
- Rename - prompts to rename the Method
- Delete - prompts to delete the Method
- Online Help - shows this page in a browser
Double-clicking a REST Service opens the REST Service Viewer which is basically layed out as the corresponding WSDL Interface viewer:
- An "Overview" tab showing basic information about the WADL
- A "Service Endpoints" tab allowing for management of service endpoints and default authentication settings.
- A "WADL Content" tab displaying the WADL and its references XML-Schemas.
The toolbar for this tab contains the following actions (left to right):
- Back - navigates back in the content tree
- Forward - navigates forward in the content tree
- Generate Documentation - prompts to generate HTML documentation for this WADL
- Export WADL - prompts to export the WADL and referenced schemas to a local folder
- Recreate WADL (not shown in screenshot) - for generated WADLs, regenerates the WADL from the defined REST artifacts.
Generate TestSuite
The "Generate TestSuite" option on the REST Service popup opens the following dialog:
The options available are:
- TestSuite : target TestSuite or option to create a new one
- Style : how to generate TestCases
- Resources : a "flattened" list of all resources in the Service
- Generate LoadTest : if a default LoadTest is to be created for each generated TestCase
Pressing OK will generate one REST RequestStep for each selected Resource, either all in one TestCase or in one TestCase for each.
WADL2Java Integration
soapUI integrates with the wadl2Java tool included in the WADL toolkit allowing one to generate java code from both imported and generated WADLs. Selecting the WADL2Java option on the REST Service popup opens the following dialog:
The options in the dialog correspond to those for the tool, once the path to wadl2java has been set in the global tool integration settings and the dialog has been configured as desired, pressing OK will launch the tool to generate the corresponding Java classes: