Forum Discussion

nulllaw's avatar
Occasional Contributor
12 years ago

How to change the webservice wsdl url by script?

Hi all,

I have a pool of machine which are running same webservice there. My task is to check all the webservice of those machines are healthy.

My question is how can I pass the WDSL as a parameter in webservice project? As there is more than 50 machines, it is unwise to create the webservice project one by one.



1 Reply

  • AlexKaras's avatar
    Champion Level 3

    Unfortunately, AFAIK, it is not possible now to specify/change the web server address during runtime.

    One possible working approach that you may consider is:

    a) To create a set of WebService test items in TestComplete project, one item per web service for every test machine (yes, you will have more than 50 identical WebService test items in the test project that differ only by the server address, but there is no workaround for this, unfortunately);

    b) Workout some naming convention when creating WebService test items and follow it. Let's assume that the test items are named following the 'WS_<ip_address>' pattern;

    c) Create two Project Variables in test project. Assume their names are sv_oService and sv_strServerAddress. The former variable should be temporary of object type, while the latter is persistent of string type;

    d) Assign address of the tested server to the sv_strServerAddress variable (e.g. '');

    e) Create a function that will be executed on the beginning of the test (for example, this may be a OnStartTest handler). The function should contain the following code (untested DelphiScript pseudocode):

    var testedServiceName;

    testedServiceName := 'WS_' + Project.Variables.sv_strServerAddress;

    Project.Variables.sv_oService = evaluate(testedServiceName);

    f) After the above code is executed, the sv_oService variable will reference the WebService test item corresponding to the web service running on the tested server (the name of which is stored in the sv_strServerAddress variable);

    g) Make a calls to the web service methods (e.g. call to CreateNewQuote()) using the sv_oService variable. E.g. (untested DelphiScript pseudocode):

    var QuoteID;

    QuoteID := Project.Variables.sv_oService.CreateNewQuote();

    Hope this will help...