ClientCertificate Property

Applies to TestComplete 15.63, last modified on April 23, 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

Use this property to define the client certificate used by a user to identify himself in the tested web service.

Declaration

WebServiceCredentialsObj.ClientCertificate

Read-Only Property ClientCertificate object
WebServiceCredentialsObj An expression, variable or parameter that specifies a reference to a WebServiceCredentials object

Applies To

The property is applied to the following object:

Property Value

The ClientCertificate object that assists you in specifying the client certificate.

Remarks

In Microsoft objects, the ClientCertificate object is implemented via the X509CertificateInitiatorClientCredential class. For more information, see documentation on X509CertificateInitiatorClientCredential Class in the MSDN Library.

Example

The following code defines the client certificate via the ClientCertificate object.

JavaScript, JScript

function ServiceSertificate()
{
  var MyWebService, Crd, Certificate;
  
  // Obtain the tested web service
  MyWebService = WebServices.SampleWebService;
  
  // Call a web service Credentials property
  Crd = MyWebService.Credentials;
  
  // Obtain the client certificate object
  Certificate = Crd.ClientCertificate;
  
  // Defines the client certificate
  Certificate.SetCertificateEx(slLocalMachine, snMy, ftFindBySerialNumber, "11 b3 a6 b8 85 45 bd a4 41 91 91 33 ff 32 5d c3");
}

Python

def ServiceSertificate():
  # Obtain the tested web service
  MyWebService = WebServices.SampleWebService
  # Call a web service Credentials property 
  Crd = MyWebService.Credentials
  # Obtain the client certificate object
  Certificate = Crd.ClientCertificate
  # Defines the client certificate
  Certificate.SetCertificateEx(slLocalMachine, snMy, ftFindBySerialNumber, "11 b3 a6 b8 85 45 bd a4 41 91 91 33 ff 32 5d c3")

VBScript

Sub ServiceSertificate

  Dim MyWebService, Crd, Certificate
  
  ' Obtain the tested web service
  Set MyWebService = WebServices.SampleWebService
  
  ' Call a web service Credentials property
  Set Crd = MyWebService.Credentials
  
  ' Obtain the client certificate object
  Set Certificate = Crd.ClientCertificate
  
  ' Defines the client certificate
  Call Certificate.SetCertificateEx(slLocalMachine, snMy, ftFindBySerialNumber, "11 b3 a6 b8 85 45 bd a4 41 91 91 33 ff 32 5d c3")

End Sub

DelphiScript

function ServiceSertificate();
var
  MyWebService, Crd, Certificate: OleVariant;
begin

  // Obtain the tested web service
  MyWebService := WebServices.SampleWebService;
  
  // Call a web service Credentials property
  Crd := MyWebService.Credentials;
  
  // Obtain the client certificate object
  Certificate := Crd.ClientCertificate;
  
  // Defines the client certificate
  Certificate.SetCertificateEx(slLocalMachine, snMy, ftFindBySerialNumber, '11 b3 a6 b8 85 45 bd a4 41 91 91 33 ff 32 5d c3');

end;

C++Script, C#Script

function ServiceSertificate()
{
  var MyWebService, Crd, Certificate;
  
  // Obtain the tested web service
  MyWebService = WebServices["SampleWebService"];
  
  // Call a web service Credentials property
  Crd = MyWebService["Credentials"];
  
  // Obtain the client certificate object
  Certificate = Crd["ClientCertificate"];
  
  // Defines the client certificate
  Certificate["SetCertificateEx"]( slLocalMachine, snMy, ftFindBySerialNumber, "11 b3 a6 b8 85 45 bd a4 41 91 91 33 ff 32 5d c3" );
}

See Also

WebServiceCredentials Object
About Testing Web Services

Highlight search results