WebServices.CreateWebServiceInfo Method

Applies to TestComplete 15.31, last modified on March 17, 2022
Testing web services with TestComplete is obsolete. We recommend that you use ReadyAPI, another SmartBear's automated testing tool for SOAP and REST web services.
If needed, you can run ReadyAPI tests from TestComplete.

Description

The CreateWebServiceInfo method loads and parses the WSDL document at the specified location and returns a WebServiceInfo object holding information about the specified web service.

Declaration

WebServices.CreateWebServiceInfo(WSDLUrl, ServiceName, SoapVersion)

WSDLUrl [in]    Required    String    
ServiceName [in]    Required    String    
SoapVersion [in]    Required    Integer    
Result A WebServiceInfo object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

WSDLUrl

The location of the web service’s WSDL document. You can specify the path to the WSDL document on a local or network drive as well as its URL address.

ServiceName

Specifies the name of the desired web service.

SoapVersion

Web services use the SOAP protocol that transmits data in the XML format. The SoapVersion parameter specifies which protocol version will be used for data transmission. You can specify one of the following constants defined in the WebServices object:

Constant Value Description
svSoap11 0 SOAP 1.1
svSoap12 1 SOAP 1.2

Result Value

A WebServiceInfo object corresponding to the specified web service.

Remarks

If the desired service is added to the Web Services project item, it is recommended to use the CreateWebServiceInfoFromItem instead of CreateWebServiceInfo. This way you can avoid re-parsing the service’s WSDL document and thus speed up test execution.

Example

The following code loads the WSDL document specified by its URL and obtains the object that holds information about the tested web service.

JavaScript, JScript

function WebServiceInfo()
{

  var WebServiceInfo, URL, ServiceName, SoapVersion;

  // Specifies the URL address of the web service's WSDL document
  URL = "http://secure.smartbearsoftware.com/samples/testcomplete15/webservices/Service.asmx?WSDL";
  // Specifies the web service's name
  ServiceName = "SampleWebService";
  // Specifies the protocol version to be used
  SoapVersion = WebServices.svSoap11;

  // Obtains the WebServiceInfo object
  WebServiceInfo = WebServices.CreateWebServiceInfo(URL, ServiceName, SoapVersion);

}

Python

def WebServiceInfo():
  # Specifies the URL address of the web service's WSDL document
  URL = "http://secure.smartbearsoftware.com/samples/testcomplete14/webservices/Service.asmx?WSDL"
  # Specifies the web service's name
  ServiceName = "SampleWebService"
  # Specifies the protocol version to be used
  SoapVersion = WebServices.svSoap11
  # Obtains the WebServiceInfo object
  WebServiceInfo = WebServices.CreateWebServiceInfo(URL, ServiceName, SoapVersion)

VBScript

Sub WebServiceInfo

  Dim WebServiceInfo, URL, ServiceName, SoapVersion

  ' Specifies the URL address of the web service's WSDL document
  URL = "http://secure.smartbearsoftware.com/samples/testcomplete15/webservices/Service.asmx?WSDL"
  ' Specifies the web service's name
  ServiceName = "SampleWebService"
  ' Specifies the protocol version to be used
  SoapVersion = WebServices.svSoap11

  ' Obtains the WebServiceInfo object
  Set WebServiceInfo = WebServices.CreateWebServiceInfo(URL, ServiceName, SoapVersion)

End Sub

DelphiScript

procedure WebServiceInfo();
var WebServiceInfo, URL, ServiceName, SoapVersion;
begin

  // Specifies the URL address of the web service's WSDL document
  URL := 'http://secure.smartbearsoftware.com/samples/testcomplete15/webservices/Service.asmx?WSDL';
  // Specifies the web service's name
  ServiceName := 'SampleWebService';
  // Specifies the protocol version to be used
  SoapVersion := WebServices.svSoap11;

  // Obtains the WebServiceInfo object
  WebServiceInfo := WebServices.CreateWebServiceInfo(URL, ServiceName, SoapVersion);

end;

C++Script, C#Script

function WebServiceInfo()
{

  var WebServiceInfo, URL, ServiceName, SoapVersion;

  // Specifies the URL address of the web service's WSDL document
  URL = "http://secure.smartbearsoftware.com/samples/testcomplete15/webservices/Service.asmx?WSDL";
  // Specifies the web service's name
  ServiceName = "SampleWebService";
  // Specifies the protocol version to be used
  SoapVersion = WebServices["svSoap11"];

  // Obtains the WebServiceInfo object
  WebServiceInfo = WebServices["CreateWebServiceInfo"](URL, ServiceName, SoapVersion);

}

See Also

WebServiceInfo Object
CreateWebServiceInfoFromItem Method

Highlight search results