When testing web services, I constantly find myself needing to run the same set of service test tests against multiple environments.
In order to do this, without having to have the same scripts copied multiple times for each environment, I dynamically set the WSDL's endpoint.
Changing a Service Test's endpoint
Changing a scripts endpoint in Service Test is actually real easy:
-
Click on the web service operation in the main canvas area and under its property sheet click on 'General' icon
- Notice the Endpoint Address and SoapAction properties -- you can easily point them to either an Input Property that you've created or to a previous action like a Read from File.
How to Setup an EndPoint Input Property Variable
-
Click on the 'Start' action
-
Click on the Start's Property Sheet 'Add Properties' icon and select 'Add Input Property'
-
In the 'Add Input Property' create a variable named EndPoint:
-
You should now have an input property:
- Navigate back to your operation's 'General' area and for the Endpoint Address click on the 'Link to data source"
-
In the Select Link Source to 'Endpoint Address', point to the 'EndPoint' input property we just created
-
Run the script and in the Run dialog click on the Input Parameters tab to set the EndPoint:
How to read the endpoint from a file
Another approach is the write out the endpoint to a local file and when the script runs read in the value from the file.
- Add a 'Read from File' activity into the main canvas area
-
Under the Read from File's property sheet set the 'File path' to the file that contains the endpoint info:
- Navigate back to your operation's 'General' area and for the Endpoint Address click on the 'Link to data source"
-
In the Select Link Source to 'Endpoint Address' and point to the read from file's 'Content' output value
- Run the script and it should read the endpoint from the file
That's it
Cool! You should now be able to run the same Service Test script against multiple environments.

{ 2 comments… read them below or add one }
Hi,
Actually this solution doesnt work, as here we have to change WSA Addressing(Security settings) as per the endpoint. So if we change endpoint from text file, we can link them to endpont from General tab for Operation but there is no any way to link WSA Addressing.
So kindly provide me the best possible solution.
Thanks !
Sachin Walukar
Joe, I’m curious how we might be able to use custom code to accomplish something similar by reading from a test resource in QC. I have found some limitations with the way QC / ST can accept data when using Business Components and Business Process Tests. For example you can only link to a single data sheet which means that if I want to feed values in from QC via a data sheet I have to have a single data sheet that contains all my test data AND the endpoint, likely meaning the endpoint is repeated on every line of the tests data. How can I setup a test to obtain the endpoint from a single location in QC (test resources ideally) but also accept a data sheet full of input data?