Skip to main content

Triggering Web Services Using QTP

                      Triggering Web Services Using QTP
 
'Web Service url
sWebserviceURL=  "http://sample.wsdl"

'Input file
InputRequest = "C:\Jay\Input.txt"

'response or output file
sOutputXML= "C:\Jay\Output.txt"

'Fso Object
Set fso = CreateObject("Scripting.FileSystemObject")

'read the input file
Set f = fso.OpenTextFile(InputRequest,1)
sInFileContent =   f.ReadAll
f.close

'xml object
Set http = CreateObject("MSXML2.ServerXMLHTTP.3.0")

'open the connection
http.open "POST", sWebserviceURL,False
http.setRequestHeader "content-type","text/xml"

'Send the input file
http.send sInFileContent

'read the response
OutputResponse=http.ResponseText

'write into output file
Set f = fso.OpenTextFile(sOutputXML , 2, True)
f.Write(OutputResponse)
f.close
set f= nothing
set fso=nothing

Comments