TypeFactory Property

Applies to TestComplete 15.62, last modified on March 19, 2024
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 TypeFactory property lets you create complex parameters for web services’ method calls.

Declaration

WebServiceObj.TypeFactory

Read-Only Property Object
WebServiceObj An expression, variable or parameter that specifies a reference to a WebService object

Applies To

The property is applied to the following object:

Property Value

The object returned by the TypeFactory property holds properties whose names coincide with names of complex types defined in the web service’s WSDL document. Using the TypeFactory property, you can create complex parameters for web services’ method calls and specify their property values.

Example

The following code creates an object needed to call a web service method, specifies the object’s properties and passes the object to the method.

JavaScript, JScript

function TypeFactoryDemo()
{

  var TypeFactory, Obj, Str;

  // Obtains an object for a method call
  Obj = WebServices.SampleWebService.TypeFactory.SampleTestClass;
  // Specifies the object’s parameters
  Obj.Name = "Complex Parameter";
  Obj.X = 15;
  Obj.Y = 15;
  // Passes the object to the method and obtains the result
  Str = WebServices.SampleWebService.SetSampleObject(Obj);
  // Posts the result to the log
  Log.Message(Str);

}

Python

def TypeFactoryDemo():
  # Obtains an object for a method call 
  Obj = WebServices.SampleWebService.TypeFactory.SampleTestClass
  # Specifies the object's parameters 
  Obj.Name = "Complex Parameter"
  Obj.X = 15
  Obj.Y = 15
  # Passes the object to the method and obtains the result 
  Str = WebServices.SampleWebService.SetSampleObject(Obj)
  # Posts the result to the log 
  Log.Message(Str)

VBScript

Sub TypeFactoryDemo

  Dim TypeFactory, Obj, Str

  ' Obtains an object for a method call
  Set Obj = WebServices.SampleWebService.TypeFactory.SampleTestClass
  ' Specifies the object’s parameters
  Obj.Name = "Complex Parameter"
  Obj.X = 15
  Obj.Y = 15
  ' Passes the object to the method and obtains the result
  Str = WebServices.SampleWebService.SetSampleObject(Obj)
  ' Posts the result to the log
  Log.Message(Str)

End Sub

DelphiScript

procedure TypeFactoryDemo();
var
  TypeFactory, Obj, Str;
begin

  // Obtains an object for a method call
  Obj := WebServices.SampleWebService.TypeFactory.SampleTestClass;
  // Specifies the object’s parameters
  Obj.Name := 'Complex Parameter';
  Obj.X := 15;
  Obj.Y := 15;
  // Passes the object to the method and obtains the result
  Str := WebServices.SampleWebService.SetSampleObject(Obj);
  // Posts the result to the log
  Log.Message(Str);

end;

C++Script, C#Script

function TypeFactoryDemo()
{

  var TypeFactory, Obj, Str;

  // Obtains an object for a method call
  Obj = WebServices["SampleWebService"]["TypeFactory"]["SampleTestClass"];
  // Specifies the object’s parameters
  Obj["Name"] = "Complex Parameter";
  Obj.X = 15;
  Obj.Y = 15;
  // Passes the object to the method and obtains the result
  Str = WebServices["SampleWebService"]["SetSampleObject"](Obj);
  // Posts the result to the log
  Log["Message"](Str);

}

See Also

About Testing Web Services
LastRequest Property
LastResponse Property

Highlight search results