WebService object provides a scripting interface to a tested web service added to the Web Services collection of your TestComplete project:
To obtain the
WebService object in tests, use the following syntax:
WebServices is the predefined name of the top-level object that provides access to the collection of tested web services. To access the object, you must have the Web Services collection added to your project. See Adding and Removing Project Items and Their Child Elements.
WebServiceItem_Name is the name of the Web Service item that is added to the Web Services collection of your project and stores information on your tested web service. You can view the name in the Project Explorer panel.
WebService object contains methods whose names and parameters coincide with the names and parameters of methods of the tested web service. In addition, the
WebService object contains several properties that help you create complex objects needed for methods’ calls and help you analyze the contents of the last request sent to and the last response received from the service. For more information, see Testing Web Services.
The following example shows how to get the tested web service in script and how to call its methods.
def WebServiceDemo(): # Obtains the tested web service MyWebService = WebServices.SampleWebService # Calls a web service method that returns a string Str = MyWebService.HelloWorld # Posts the string returned by the web service method to the log Log.Message(Str)