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:
Right-click the service in the Navigator panel and select Generate Virtual Service from the context menu:
– or –
Select the service in the Navigator and, on the main menu, select API > Generate Virtual Service:
In the subsequent 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:
|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.|
The resource name that will be added to the service URL. For example, if Path is
|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.|
|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 ServiceV 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.