This topic explains how to create virtual assets from a RAML definition.
Virtualize can automatically create a .pva based on the endpoints found in a RAML description. Each .pva generated via the RAML wizard will contain Message Responders for all of the defined endpoints.
RAML 0.8 and 1.0 are supported.
This is especially helpful if the service you want to virtualize is not available for live recording, but you have access to a definition file that describes it.
There are two main steps involved in virtualizing the application behavior from a definition file:
- Creating Message Responders from that definition file.
- Deploying those Message Responders.
Creating Message Responders from a Definition File
To automatically create Message Responders from a RAML definition:
- Choose the REST> RAML option in one of the available project/.pva/Responder suite creation wizards.
- For details on accessing the wizards, see Adding Projects, Virtual Assets, and Responder Suites.
- In the RAML wizard page, enter the absolute URI at which to find the RAML definition in the RAML Definition field. To reference a file on your local system, use a file URL (for example, file:///c:/Users/user/API.raml).
- Click the Finish button.
Virtualize will then create one Message Responder configured for each resource/method/status code in the RAML definition. A sample message (if available) is included in the response. If the service definition includes a schema, that schema is used to construct and constrain the response.
You can use the available controls to specify the response messages. For more details about reviewing and customizing the options in the tools that are created, see Message Responder Overview.
Deploying the Virtual Assets
If the .pva is created directly in the VirtualAssets project, it will be deployed automatically. Otherwise, the simplest way to deploy the virtual asset is to copy the containing .pva file into the VirtualAssets project.
Alternatively, you could right-click the Virtualize Server view’s Local machine node, choose Add Virtual Asset, specify the .pva file that includes the virtual assets you want to deploy, then click Finish. When the wizard completes, Virtualize will automatically copy the .pva file to the VirtualAssets project.
For a more detailed discussion of deployment procedures and options, see Deploying Virtual Assets.
Customizing the Virtual Assets
For details on how to customize the Message Responder’s behavior, see Message Responder Overview.