01 March 2010 - 3.5 |
Parameters and Representations a key concepts in a REST-style service; Parameters for parameterizing a resource and its access methods, Representations for defining how a Resource can be retrieved and updated.
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)
Depending on a parameters Style in the above table, its value will be added to an outgoing request in different ways:
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)
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:
These settings mainly affect two behaviours in soapUI:
As you can see above the generated form contains drop-downs, type-information, etc as configured for each parameter.
A REST request can both send or receive an arbitrary number of representations. In requests these correspond to the content of the message body (PUT or POST messages), in responses these correspond to the actual content of the response. Which actual representation returned of course depends on the actual resource implementation; from a strict HTTP-point-of-view, the HTTP Accept-Encoding header should be set in the request to let the resource "know" how it should return itself. A more common alternative is to have parameter in the request that specified the desired representation (as the "output" parameter in the parameters table above).
soapUI visualizes request and response representations with corresponding inspectors at the bottom of the request/response editors:
If the underlying resource has been imported from a WADL, this table will contain the representations defined therein, otherwise it will be empty. The columns are:
Using the add/delete buttons in the toolbar allows one can add/remove representations as desired (to be used for validation and WADL generation). Selecting the Auto-Create option will make soapUI automatically create representations for each incoming response and outgoing request.