By default, when a virtual service (virtual API) is deployed to VirtServer, it uses the port you specified in ReadyAPI. However, on VirtServer, the port may be used either by another service that is running on VirtServer, or by some other resource running on the computer where VirtServer is hosted.
VirtServer does not reassign the port automatically in this case. Instead, it completes the deployment and displays a message informing you about the issue:
In this case, you need to change the port settings of your virtual service on VirtServer.
|Note:||VirtServer checks the ports of running virtual services only. If a service with the same port is not running, no warning will be displayed.|
|Note:||If you are deploying a virtual service that is already on VirtServer (that is, if you are updating your virtual service), VirtServer will complete the deployment and then check the port numbers. If the ports differ, VirtServer will automatically use the port that is set on VirtServer for the deployed service. It will also display a message informing you about the change. If the ports are the same, no message will be shown.|
To override the virtual service port on VirtServer from ReadyAPI:
Select the virtual service on the Virtual Services page of the VirtServer panel. You will see the service’s properties on the right.
Set a new port in the Port edit box and click Change port.
– or –
Click Auto-assign a free port:
The virtual service port will be changed on VirtServer only. On your computer, the service will use the same port it used before the deployment.
Using web interface
To change the port from the VirtServer web interface:
Go to the home page of VirtServer:https://<virtserver-host>:<port>/virtserver#/
For example, if VirtServer is installed on your local machine and you run it on the default port, use the following link:
Click the port number in the Port column for your virtual service:
Enter a new port value and click Save. If the port is already used, VirtServer will warn you about the issue. Click Assign Available Port to assign the closest available port.
Using command-line interface
To change a virtual service port on VirtServer with the command-line utility, use the
-update command. You can read more about it in this topic.
Tip: Specifying virtual service port in tests
When creating tests for a virtual service, you may not know the port it will use on VirtServer. If you hard-code the port number in your tests, you will need to change it after the service is deployed to VirtServer. As a workaround, you can create a project-level or test-suite-level property that will store the virtual service address and port values and specify this variable as the Endpoint property of your test requests. If the port number changes, you will need to modify the project-level (or test-suite-level) property, rather than update the Endpoint properties in all the requests: