Creating a Web URL schema
You can create a Web URL schema to use with REST services by adding URLs to the Schema Library.
About this task
Use the Web URL schema to construct or parse URLs in HTTP request messages (either sent by a test or received by a stub). The simplest way to create a Web URL schema is to import the information from an example URL.
Procedure
- In the Schema Library view of the Architecture School perspective, click the arrow next to the Add button, then click .
- In the New URL dialog box, enter a name in the Schema Name field.
- To import a schema, click the Import URL template icon
().The Import URL Template dialog is displayed. Alternatively you can click the green plus sign (Add new URL template) and go to step 5.
- To import a schema, enter an example URL for the REST service
in the Importing URL field.The wizard attempts to parse the URL based on the separators that are specified in the Separating on the literals field. If you must change these separators, click Add or Remove. Click OK to proceed to the editing window where you can modify segments of the URL.
- If you are creating the schema, the
dialog box is named Create New URL Template and
you must complete the fields yourself. If you are importing the schema,
the dialog box is named Edit URL Template and
the fields contain information from the preceding dialog box. In both
cases, the following fields are displayed:Click OK when you are finished with the template for this URL.
Table 1. URL template fields Field Description Template Name A name to describe the schema. Parameterized URL This field cannot be edited. The URL shows the current state of the combined path and query segments. Path Segments The parts of the URL that provide a path to the REST service. To add a segment, click the green plus sign (Add new path segment) and provide the following information: - Literal
- To enter literal characters, enter a segment of the parameterized URL.
- Parameterized
- To enter a parameter that will be replaced by a real value later, enter the name of the parameter. For a parameterized segment, you must also complete the Type field.
- Type
- For parameterized content, select a data type from the list.
Query Segments The parts of the URL that make up the query string. To add a segment, click the green plus sign (Add new path segment) and provide the following information: - Literal
- To enter literal characters, enter a segment of a URL.
- Parameterized
- To enter a parameter that will be replaced by a real value later, enter the name of the parameter. For a parameterized segment, you must also complete the Type field.
- Default Value
- An optional initial value of a parameterized segment.
- Type
- For parameterized content, select a data type from the list.
Request contains body of type Select the check box if resources are sent as part of the request. The following content types are available: - Form Data
- Text
- Byte Array
- Click OK when you are finished with
the schema.The new schema is displayed when you click Web URL in the left panel of the Schema Library.