Create a Service Image from RAML

This procedure describes how to create a virtual service image from RESTful API modeling language (RAML).
dts106
This procedure describes how to create a virtual service image from RESTful API modeling language (RAML). Virtual service creation using RAML is supported in DevTest Workstation only.
DevTest Solutions
supports RAML 0.8 and 1.0 specs.
A RAML can define message bodies using a combination of Schema and Example properties. The Example property is used for the transaction body in
DevTest
. Ensure that you specify the Example property in a message body, or else the Schema property is used instead.
The Schema property is not interpreted in any way and appears exactly as specified in the transaction body within
DevTest
.
Follow these steps:
  1. Complete one of the following options:
    • Right-click
      VirtualServices
      on the
      Project
      panel and select
      Create New VS Image
      ,
      From RAML
      .
    • From the
      File
      menu, select
      New, VS Image, From RAML.
    The
    Virtual Service From RAML
    window opens.
  2. Enter a service image name and the name of a VS model file.
    To load parameters from a previously saved service image, click
    Load from File
    Image of blue folder icon at the bottom of the window.
    For more information about field descriptions, see Basics Tab.
  3. Click
    Next
    .
  4. In the
    Listen on port
    field at the bottom of the window, enter the port number to which the virtual service listens.
  5. In the
    RAML URL
    field, add the RAML of the web service to virtualize.
    You can also select the RAML from the drop-down list, or click
    Browse
    to locate the RAML from the file system.
    This entry can be a RAML file on the file system or a URL.
  6. Click
    Refresh RAML Cache
    Load from File icon .
    DevTest
    parses the RAML and populates the Endpoint field and the Methods pane.
    If
    DevTest
    fails to parse the RAML, a warning icon displays after the Endpoint field. To view the error message, click the warning icon.
  7. In the
    Methods
    pane, select the methods to virtualize.
    By default, all the methods are selected. You can click
    Select All
    or
    Select None
    , as appropriate. At least one method is required.
  8. Click
    Next
    .
  9. Add or chain other Data Protocol Handlers as appropriate. By default, the Rest Data Protocol Handler is selected.
  10. Click
    Next
    .
    On the next window, the service image is generated and the wizard is finished.
  11. Click
    Finish
    .
    To save the settings on this recording to load to another service image recording, click
    Save
    Image of the Save icon above the
    Finish
    button.
We support parsing any external files that are referred in the RAML file
include tag
only if they are present in the path relative to the RAML file.
Examples
1. If the RAML file is present in
C://%LISA_HOME%/Data/test.raml
and it references an external file external.yaml in its include tag as follows:
traits: !include external.yaml
Then the external.yaml file should be present at
C://%LISA_HOME%/Data/external.yaml.
2. If the RAML file is present in
C://%LISA_HOME%/Data/test.raml
and it references an external file present at path dependencies/external.yaml in its include tag as follows:
traits: !include dependencies/external.yaml
Then the external.yaml file should be present at
C://%LISA_HOME%/Data/dependencies/external.yaml.
The parameter lisa.vse.rest.max.optionalqueryparams specifies the maximum number of optional query parameters to process per method in a RAML file. The default is five; any optional parameters after the fifth one are ignored. We recommend that you do not change the value above five. This can result in the number of generated responses growing exponentially after the fifth one.