Absent Member.
Absent Member.

QTP Webservices Response

Hi I'm relatively new to using QTP's webservices add-in and was wondering if anyone could provide an code example or point me to a website of what syntax to use to send data through a webservice? I have an example of how to pull data but not how to send. I basically have a table of results from an operation I'm trying to send through a webservice to our Dev Team. Thanks in advance!
2 Replies
Knowledge Partner
Knowledge Partner

I'm assuming you know the WebService NAme, URL, Port & Calling params whereby you can build your own, sort of DP for WebServices, here's a de-sensitized version of one of my calls:

' Define WebService URL
ws1 = "wsdl:="
' Define service & port
ws2 = "service:=GenericSQLExecutorService"
ws3 = "port:=STFSQLExecutionService"
' Define params
p1 = "cust.database"
p2 = "Select * From CUST Where CUST_ACC_NO = '92983847546'"
' Call to the WebService
executeSQLByDBName = WebService(ws1,ws2,ws3).executeStoredProcedureByName(p1,p2)

' Data is returned to executeSQLByDBName

Mark Smith.
Absent Member.
Absent Member.

I have one day of experience in using QTP with webservices -add-in.

With the information i browsed around, here is how I could send a request and capture the response.

1. Go to Object repository -Resources and click on the "Webservices add object wizard"

provide your WSDL file (webservice url)
exampl:-e http://abcdefg.asmx?WSDL

in the following steps, u will nedd to provide the service name and port name.

lets say the webservice object u created in OR is called "ABCDEFG_WSService"

2. In expert view, you can add call the webservice
WebService("ABCDEFG_WSService").IntellisenseWill ListyourWebservices(Param1, Param2, Param3...if any)

ResXML =WebService("Cudl3ForCudlConnect_WSService").GetEmplopyInformation(100)

where "GetEmplopyInformation" is the webservice and requries employId as input.

The variable "ResXML" will have the response as a string.

I know its basic..but it took me an hour figure this out.. I'll be happy if this information saves one's time.
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.