Monday, March 17, 2008

Call a web service from Rational ClearQuest hook

Dim oXMLDoc, oXMLHTTP

Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")

Set oXMLDoc = CreateObject("MSXML2.DOMDocument")

' oXMLHTTP.onreadystatechange = getRef("HandleStateChange")

call oXMLHTTP.open("POST","http://localhost:3166/CQWS.asmx/InsertBaseCM2",False)

call oXMLHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")

call oXMLHTTP.send("basecmdata=TEST")
if(oXMLHTTP.readyState = 4) then

dim szResponse: szResponse = oXMLHTTP.responseText

' Msgbox(oXMLHTTP.responseText)
call oXMLDoc.loadXML(szResponse)

if(oXMLDoc.parseError.errorCode <> 0) then

call msgbox(oXMLDoc.parseError.reason)

else

call msgbox(oXMLDoc.getElementsByTagName("string")(0).childNodes(0).text)

end if

end if

No comments: