VIDEO – How to test a web service using QTP with the web service add-in

by Joe Colantonio on December 18, 2010

Post image for VIDEO – How to test a web service using QTP with the web service add-in


In this video I show how to test a web service using HP's QuickTest Professional.

This is the Microsoft.XMLDOM function that I used for the demo:

Public Function GETNODE(xmlString,nodeName,optNodeNum)

Dim xmlDoc
Dim nodeList
Dim currentNodeValue
Dim nodeFoundFlag
Dim nodeCounter

   Set xmlDoc = CreateObject("Microsoft.XMLDOM")
   xmlDoc.Async = "false"
   xmlDoc.LoadXML(xmlString)

	   if optNodeNum = "" then
		   optNodeNum = 1
	   end If

	   Set nodeList = xmlDoc.getElementsByTagName(nodeName)

       nodeCounter = 1
	    'If an element is not found that matches the passed nodeName then this for loop will not run
				For each Node in nodeList
					currentNodeValue = node.text
					'If there are more than one element with the same name stop on the optNodeNum or default to 1st  matching node found
						If cint(optNodeNum) = nodeCounter then
							nodeFoundFlag = "True"
							Exit for
						end if
				   nodeCounter = nodeCounter + 1            
				Next

							If nodeFoundFlag = "True" Then
								GETNODE = currentNodeValue
							 Else
							   GETNODE = "False"
							End If

Set xmlDoc = nothing


End Function

{ 32 comments… read them below or add one }

Saurabh December 20, 2010 at 9:06 am

Hi Joe,

Fantastic demo !!!

I have a question what are the advantages of HP Service Test over QTP with Web Service plugin?

Looking forward for your reply.

Cheers,
Saurabh

Reply

Joe Colantonio December 20, 2010 at 9:39 pm

@Saurabh: Hi Saurabh – In my opinion it so much easier to create tests for web services in Service Test 11 compared to QTP. ST was created for this type of testing so it more intuitive to use. QTP has odd poorly documented web service methods that make it hard to figure out how to do certain functionality. Also Service Tests also has the following feature that QTP doesn’t:

Script can be used as Performance test in LoadRunner
Built in support for XPath expressions
Built in support for Soap Fault testing
Built in support for REST Services
Built in scenarios for configuring security in Web Service calls

Reply

Roopak March 14, 2011 at 8:24 pm

Hi Joe,

In addition to what you stated regarding the advantages of HP ST over QTP, one more point I want to add… As per my observations, if the WebService is too complex, many a times we have seen that QTP is not able to import the service rather it get crashed where as ST can easily import the service.

Correct me if I am wrong and Thanks for your informative videos.

Reply

Joe Colantonio March 14, 2011 at 8:37 pm

@Roopak: Hi Roopak –I totally agree – if someone is doing complicated web service testing then ST is 100% better then QTP. Thanks for checking out my video!

Reply

Vinay May 10, 2011 at 1:23 pm

Fabulous explanation Joe.

Reply

Joe Colantonio May 10, 2011 at 1:36 pm

Vinay » Thanks Vinay – Glad you liked it!

Reply

archana October 8, 2011 at 7:47 am

Hi Joe ,
Awesome video . Thanks for sharing .

Reply

Joe Colantonio October 8, 2011 at 5:42 pm

archana » Thanks – glad you liked it! Cheers~Joe

Reply

Naresh October 20, 2011 at 5:22 am

Hi Joe, I came to this page to see VIDEO on “How to test a web service using QTP with the web service add-in”. But I dont see any video playing here. But also I could not see any play button to click and start it. Will you please help me out to see the video? Thanks in advance!

Reply

Joe Colantonio October 20, 2011 at 11:06 am

Naresh » Hi Naresh – not sure why you are not seeing it. I just dbl checked and I was able to see and play the video. Can you please try again? :
http://www.joecolantonio.com/2010/12/18/video-how-to-test-a-web-service-using-qtp-with-the-web-service-add-in/

It is also on YouTube if for some reason you still can not access it from my web page:
http://www.youtube.com/user/JoeColantonio?blend=21&ob=5#p/u/0/q8bFOj-tnMU

Cheers~Joe

Reply

Naresh November 4, 2011 at 6:40 am

Hello Joe, Thanks for the response. Actuly the problem was, I was trying access it from my company network. And videos like this are restriced in our company network, so it did not work for me. But when I tried it from my home network it worked. The video is also really helpful. Thanks Again!!!

Reply

Naresh November 4, 2011 at 6:48 am

Hello Joe, Do you have any video which can demonstrate, how we can use Service test 11 in QC 11. Can you please share video if you have for the same. Thanks in advance!

Reply

rahul November 10, 2011 at 12:33 pm

Hi Joe,

Thanks for the demo and awesome explanantion of diff. between ST11 and QTP. But as you said, ST11 has built in support for REST services, does QTP support REST services testing or even webservices add-in will not be fruitful enough to test REST services.

Thanks in Advance :)

Reply

Joe Colantonio November 10, 2011 at 12:54 pm

rahul » Hi Rahul – Even with the webservice add-in QTP does have functionality to test REST services. But you can use the WinHTTP object using vbscript in QTP to test REST.
I’m not sure if you have seen but I do have a video with some sample code for using QTP to do simple REST testing:

http://www.joecolantonio.com/?p=236

Thanks for your question – hope this helps.

Cheers,

Reply

Rajesh January 27, 2012 at 5:48 am

Hi Joe,

Please can you help me know from where I can download the trial version of “Web Services Add-in” for QTP.

Thanks

Reply

Joe Colantonio January 31, 2012 at 8:59 pm

Rajesh » Hi Rajesh – all the add-ins are part of the standard QTP install. If you already installed QTP and did not add an add-in just dbl click the Qtp setup.exe again. You will get an option to “Modify” the existing install. You then will get a “Custom Setup” window where you can select the “Web Service Add-in”. Hope this helps. Cheers~Joe

Reply

Ganesh April 19, 2012 at 8:56 am

Hi joe i m using QTP11.0 i want to know after installing QTP11.0 how i added .net addons and plz give me the link of .net addons

Reply

Joe Colantonio April 20, 2012 at 3:05 pm
Rahul April 22, 2012 at 2:55 pm

Hi Joe,

I am trying to test fligt application using web service addin but i am not able to find a way to get the url of flight application. Please help me out

Thanks in advance.

Reply

Joe Colantonio April 23, 2012 at 2:14 pm

Rahul » Hi Rahul – I actually got the web service flight application from an eval copy of HP’s Service Test. You should be bale to get a free eval of HP service test from HP.

Reply

kiran May 12, 2012 at 5:47 pm

Hi Joe,
I am getting the Exception “the Action header is required when other address headers are present” while executing an webservice operation ,argument for this operation is XML Warehouse.QTP is throwing this error though I am giving valid data for all the emlements as per autogenerated xml structure.

Need Help:Why this error is coming while running the test.

Thanks in advance
Kiran.

Reply

Joe Colantonio May 16, 2012 at 11:46 pm

kiran » Hi Kiran – Sorry not sure why. I have not been able to repro that error on my end so its hard to troubleshoot.

Reply

Steve June 4, 2012 at 6:12 pm

I’m using QTP 11.0 to test an in-house webservices project.
In order to practice, I’d like to use the Flight Services you use in your video demos, but can’t find any way to down load it.

We don’t have ST 11 here, what can I do?

Thanks,

Reply

Joe Colantonio June 9, 2012 at 7:37 pm

Steve » You can either download an eval version of Service Test or you can try installing it from my download section. The file name is:
HP_WebService_SampleApplication.zip.

Reply

Steve June 5, 2012 at 3:50 pm

I just downloaded the ST 11 trial version and Patch and got the Flight Reservation Service running. But I’m gettnig the following error:

The GetFlights operation call failed.
The .NET Framework 2.0 WSE 3.0 toolkit returned the following error:
Data at the root level is invalid. Line 1, position 1.

Exception from: System.Xml
Data at the root level is invalid. Line 1, position 1.

Line (3): “Set GetFlights = WebService(“HPFlights_Service”).GetFlights(0,True,0,True)”.

Reply

Joe Colantonio June 20, 2012 at 8:51 pm

Steve » Hi Steve is this version ST 11 or St 11.20?

Reply

Steve June 12, 2012 at 5:43 pm

Okay, I finally got everything in the demo working except the 2nd CheckPoint.

Schema Validation: Failed>
1 2 Could not find schema information for the element ‘CreateFlightOrderResponse’.
2 4 Could not find schema information for the element ‘HP.SOAQ.SampleApp:CreateFlightOrder’.
3 6 Could not find schema information for the element ‘HP.SOAQ.SampleApp:OrderNumber’.
4 6 Could not find schema information for the element ‘HP.SOAQ.SampleApp:TotalPrice’.

This is a great video, I just had trouble keeping up with the way you were skipping around and editing data.

THX

Reply

Automator February 13, 2013 at 3:47 pm

I am using QTP 10 to test web services (web services Wizard) and getting proxy authentication error. “The request failed with HTTP status 407: Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )”
Is there a way to set up proxy in QTP?

Reply

Joe Colantonio February 16, 2013 at 6:41 pm

Automator » I’m not sure but this might help. From HP’s KB:
When using the web services Axis toolkit, QuickTest Professional seems to ignore the proxy settings configured through the Configuration.SetProxy function.

For example, when running:

WebService(“WebServiceName”).Configuration.SetProxy “localhost” , “8080″ , “admin”, “admin_pass”, “NET”
WebService(“WebServiceName”).ping(XMLWarehouse(“PingRequest”))

QuickTest Professional will return the error “The ping operation call failed. The Apache Axis 1.x toolkit returned the following error: ; nested exception is: java.net.ConnectException: Connection refused: connect”
Cause
The Configuration.SetProxy function is ignored when using the Axis toolkit.
Fix

Please follow the below steps to configure a proxy when using the Axis toolkit:

Save the attached proxy.prop file to a local folder.
Edit the file so that the values of the properties will reflect the proxy settings.
Add the following step to you script:

WebService(“WebServiceName”).Configuration.SetClientConfiguration “ “,null

Notes:

Make sure that the “WebServiceName” is your WebService Test Object name and that the is the path to the proxy.prop file.
This step must be the first step in the script. If you have any Web Services call prior to this step it will have no effect setting the proxy.

Reply

Izna April 17, 2013 at 6:37 pm

Hi Joe,

Thanks so much for the video..Do you have any tutorials for QTP or are you taking any classes for beginners in QTP?

Thanks

Reply

Joe Colantonio April 18, 2013 at 1:22 pm

Izna » Cool – glad the video helped. I currently don’t have any long QTP tutorials or classes other than my posts. Is there anything in particular you are looking for?

Reply

izna May 2, 2013 at 6:33 pm

I’ve been working as a Manual tester from past 3yrs on SOAP UI, I did run tests in QTP but only those test cases which were already written & I just executed them. Now I need to start working on automating my tests. Right now I am validating my test cases by running them in SOAP UI, take the response & go to SAP, look for the table & compare these 2 to check if they match & if they do my test is a success. I am new to automation & no idea about groovy scripting or vb scripting. I’ve been given the freedom to go look for a testing tool to work with. So I am just looking to options of what I can do.
Thanks,

Reply

Leave a Comment

{ 1 trackback }

Previous post:

Next post: