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

  1. In the Schema Library view of the Architecture School perspective, click the arrow next to the Add button, then click Web > Web URL.
  2. In the New URL dialog, enter a name in the Schema Name field.
  3. 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.
  4. 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.
  5. If you are creating the schema, the dialog is named Create New URL Template and you must complete the fields yourself. If you are importing the schema, the dialog is named Edit URL Template and the fields contain information from the preceding dialog. In both cases, the following fields are displayed:
    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 template for this URL.
  6. 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.

What to do next

You can apply this schema to an operation, as described in Creating an operation, or apply it to recorded events in Recording Studio, as described in Events view. When you apply a Web URL schema to recorded events, you must apply the schema to the text (String) node of the body message, not the header. This placement makes the URL values available in the body of the message.