WebServiceRequestResponseInfo Object

Applies to TestComplete 15.47, last modified on January 20, 2023
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 WebServiceRequestResponseInfo object is used within the OnWebServiceRequest and OnWebServiceResponse event handlers. The object provides information about the tested web service’s method to which a request will be sent or from which a response was received.

Members

Example

The following example demonstrates how to get information on a web service method from which a response was received:

JavaScript, JScript

// The routine calls methods of the tested web service
function Main()
{

  WebServices.SampleWebService.Method1();
  …
  WebServices.SampleWebService.Method2();
  …

}

// The OnWebServiceResponse event handler
function GeneralEvents_OnWebServiceResponse(Sender, Response, Helper, ResponseInfo)
{

  // Obtains the name of the tested web service and the name of the called web service method
  var methodName = ResponseInfo.MethodName;
  var serviceName = ResponseInfo.ServiceName;

  // Processes the response
  Log.Message("Processing the response from the " + methodName + " method of the " + serviceName + " web service");
  …

}

Python

# The routine calls methods of the tested web service 
def Main():
  WebServices.SampleWebService.Method1()
  # ...
  WebServices.SampleWebService.Method2()
  # ...

# The OnWebServiceResponse event handler 
def GeneralEvents_OnWebServiceResponse(Sender, Response, Helper, ResponseInfo):
  # Obtains the name of the tested web service and the name of the called web service method 
  methodName = ResponseInfo.MethodName
  serviceName = ResponseInfo.ServiceName
  # Processes the response 
  Log.Message("Processing the response from the " + methodName + " method of the " + serviceName + " web service")
  # ...

VBScript

' The routine calls methods of the tested web service
Sub Main

  WebServices.SampleWebService.Method1
  …
  WebServices.SampleWebService.Method2
  …

End Sub

' The OnWebServiceResponse event handler
Sub GeneralEvents_OnWebServiceResponse(Sender, Response, Helper, ResponseInfo)

  ' Obtains the name of the tested web service and the name of the called web service method
  methodName = ResponseInfo.MethodName
  serviceName = ResponseInfo.ServiceName

  ' Processes the response
  Log.Message("Processing the response from the " & methodName & " method of the " & serviceName & " web service")
  …

End Sub

DelphiScript

// The routine calls methods of the tested web service
procedure Main();
begin

  WebServices.SampleWebService.Method1();
  …
  WebServices.SampleWebService.Method2();
  …

end;

// The OnWebServiceResponse event handler
procedure GeneralEvents_OnWebServiceResponse(Sender, Response, Helper, ResponseInfo);
var methodName, serviceName;
begin

  // Obtains the name of the tested web service and the name of the called web service method
  methodName := ResponseInfo.MethodName;
  serviceName := ResponseInfo.ServiceName;

  // Processes the response
  Log.Message('Processing the response from the ' + methodName + ' method of the ' + serviceName + ' web service');
  …

end;

C++Script, C#Script

// The routine calls methods of the tested web service
function Main()
{

  WebServices["SampleWebService"]["Method1"]();
  …
  WebServices["SampleWebService"]["Method2"]();
  …

}

// The OnWebServiceResponse event handler
function GeneralEvents_OnWebServiceResponse(Sender, Response, Helper, ResponseInfo)
{

  // Obtains the name of the tested web service and the name of the called web service method
  var methodName = ResponseInfo["MethodName"];
  var serviceName = ResponseInfo["ServiceName"];

  // Processes the response
  Log["Message"]("Processing the response from the " + methodName + " method of the " + serviceName + " web service");
  …

}

See Also

About Testing Web Services
OnWebServiceRequest Event
OnWebServiceResponse Event
Adding Custom Headers to SOAP Requests

Highlight search results