In this video, I show a quick example on how to use QuickTest Pro 11 and WinHttp to test a REST service. The QTP web-addin is not needed for this example.
Below is the code used for this example:
Set myRestBody = XMLUtil.CreateXMLFromFile("C:\body.xml")
restRequest = myRestBody.ToString
url ="http://localhost:24240/HPFlights_REST/FlightOrders/"
contentType ="text/XML"
'1) Create reference to the WinHTTP request com object
Set oWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
'2) Open a HTTP connection to a HTTP resource
oWinHttp.Open "POST", url, False
'3) Add a HTTP request headers for endpoint and conent type
oWinHttp.setRequestHeader "Content-Type", contentType oWinHttp.setRequestHeader "SOAPAction", url
'4) Send a HTTP request to the HTTP server with the header and body info
oWinHttp.Send restRequest
'5) Get response
response = oWinHttp.ResponseText
'6) Close object reference
Set oWinHttp = Nothing
'7) print the response
print response