≡ Menu
Joe Colantonio – Selenium-UFT-QTP-SoapUI-ALM-LoadRunner & more

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

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


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

44 comments… add one

  • Saurabh

    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

    • Joe Colantonio

      @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

      • Roopak

        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.

        • Joe Colantonio

          @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!

  • Vinay

    Fabulous explanation Joe.

    • Joe Colantonio

      Vinay » Thanks Vinay – Glad you liked it!

  • archana

    Hi Joe ,
    Awesome video . Thanks for sharing .

    • Joe Colantonio

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

  • Naresh

    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!

  • Naresh

    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!!!

  • Naresh

    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!

  • rahul

    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 :)

    • Joe Colantonio

      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,

  • Rajesh

    Hi Joe,

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

    Thanks

    • Joe Colantonio

      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

  • Ganesh

    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

  • Rahul

    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.

    • Joe Colantonio

      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.

  • kiran

    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.

    • Joe Colantonio

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

  • Steve

    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,

    • Joe Colantonio

      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.

  • Steve

    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)”.

    • Joe Colantonio

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

      • Tejas

        I have got an error while running sample app
        QTP 11.0

        The .NET Framework 2.0 WSE 3.0 toolkit returned the following error

        any idea why ?

  • Steve

    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

  • Automator

    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?

    • 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.

  • Izna

    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

    • 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?

      • izna

        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,

  • Noohi

    Hey Joe,
    So I followed these steps & tried out a simple application, where I am trying to give the itemNumber & to find out the price. I am getting this error: dvlap530 is the dev environment that we use.
    The getPrice operation call failed.
    Exception from: System
    The remote name could not be resolved: ‘dvlap530′
    Line (2): “Set getPrice = WebService(“PricingService”).getPrice(XMLWarehouse(“pricingRequest”))”.

  • Rohit Gupta

    Hi Joe,

    I am working on a Web Services automation project using QTP 11.0.

    I tried using Web Services Wizard to create XMLWarehouse and a checkpoint to verify the response. But, I am getting a Run error “The format of the URI could not be determined”.

    Additionally, I am looking for best practices for Web Services automation using QTP 11.0 to implement in my project.

    Your help is appreciated.

    Regards
    Rohit Gupta

    • Hi – did you resolve this issue. This error is a generic error that is a catch all for an unhandled exception occurred during the execution of the current web request

      • Vijay Kumar

        Hi Joe,

        Could you please give me the Answers for the below questions.

        1) What are the Advantages of Web Services Testing using QTP ?
        2)What are the Dis – Advantages of Web Services Testing using QTP ?

        3)Topic – Solution

        Please provide me Answers for above questions.

        Thanks in Advance..

        Vijay.

    • Vijay Kumar

      Hi Joe,

      Could you please give me the Answers for the below questions.

      1) What are the Advantages of Web Services Testing using QTP ?
      2)What are the Dis – Advantages of Web Services Testing using QTP ?

      3)Topic – Solution

      Please provide me Answers for above questions.

      Thanks in Advance..

      Vijay.

      • I don’t think there are any advantages to using QTP for web services testing. Is has very limited support. I would recommend using UFT API testing or soapUI for web service testing.

  • Vijay Kumar

    Hi Joe,

    Could you please give me the Answers for the below questions.

    1) What are the Advantages of Web Services Testing using QTP ?
    2)What are the Dis – Advantages of Web Services Testing using QTP ?

    3)Topic – Solution

    Please provide me Answers for above questions.

    Thanks in Advance..

    Vijay.

  • Hi Joe,

    Is there any way to create the test checkpoint using this XMLDOM technique without coding? Or it’s available only in service test plugin?

  • Hi Joe, Some of the my application interfaces will have to be asynchronous.

    Suppose we have the Adapter and a Service User sending service requests to the Adapter.

    When the Adapter interface is asynchronous, the Service User will call a RESTful web service on the Adapter to submit a service request. The Adapter will send back a response to that web service call to the effect of “thank you for your request, I’ll deal with it and get back to you”. Sometime later, the Adapter will call the Service User using a RESTful web service that they must supply with the actual response to the service request.

    The purpose of our test tool for POC is to act as the Service User, therefore whatever test tool we use must be able to call RESTful web services and provide a RESTful web services to alow the Adapter to call them back. If we can’t find a tool that does this, we may have to write a harness for that too.

    Is it possible to achieve this using UFT? if yes then can please advice how ? or I will need to use some other test tool for this POC??

    Can you please reply to my email.
    Looking forward for your reply.

  • czai

    Hi,

    is it possible to have qtp run a soap ui pro script? aside from the web service add-in, do i need to have a specific code to implement this? thanks

Leave a Comment