Generating Virtual Services

Applies to ReadyAPI 3.56, last modified on November 25, 2024

One possible way to create a virtual service (virtual API) is to generate it from a service specification that you have in your project. This is an easy and fast way to get a service with virtual operations for multiple (or all) operations defined in your API specification.

This approach works for REST and SOAP virtual services:

  • You can generate a SOAP virtual service from a WSDL specification.

  • You can generate a REST virtual service from an OpenAPI 3.0, Swagger 2.0 or 1.x, or WADL spec.

  • JMS virtual services cannot be created this way.

Follow these steps:

  1. Right-click the service in the Navigator panel and select Generate Virtual Service from the context menu:

    Service virtualization and API testing: Generating virtual APIs

    Click the image to enlarge it.

    – or –

    Select the service in the Navigator and, in the main menu, select API > Generate Virtual Service:

    Service virtualization and API testing: Generating virtual APIs

    Click the image to enlarge it.

  2. In the subsequent dialog:

    Service virtualization and API testing: Generating Virtual Service dialog
    • Select resources (REST) or operations (SOAP) to be virtualized. ReadyAPI will create virtual requests for these operations in the generated service. Select all the resources (operations) you want to add to the service.

    • Select Create a new virtual service to generate a virtual service. A possible alternative is to add operations to an existing virtual service. See Creating Requests (Operations).

    • Specify properties of the new service:

      Setting Description
      Operations Select the operations to be added to the new service.
      Action Specifies if you want to create a new service or add operations to an existing one. If you select the latter option, the dialog changes and asks you to select the desired service.
        Visible if you create a new virtual service –
          Name The name of the new service. This name should not coincide with other service names in your project.
          Path The resource name that will be added to the service URL. For example, if Path is /my-service/v1, then the service URL will be like http://localhost:8080/my-service/v1.
          Port The port number that the new service will use. If you are going to run two services simultaneously on the same computer, use different port numbers for them.
        Visible if you add operations to an existing virtual service –
          Virtual Service Select the service to which the operations will be added.
      Add Endpoint Select this check box to add the service URL and port to the Endpoints list of the API.

    Click OK to generate the virtual service.

To see the new virtual service, select it under the APIs (Virtual) node in the Navigator panel:

As you can see, ReadyAPI generates virtual requests for the selected resources (operations) and also generates default virtual responses for each request.

See Also

Creating Virtual Services

Highlight search results