winhttprequest_qtp

上一篇 / 下一篇  2012-09-16 23:37:11

Dim sContentType,sSOAPAction,sWebService_Url,oWinHttpReq
Dim sSOAP_Request,sXMLResponse
sContentType="text/xml;charset=utf-8"
sSOAPAction=http://WebXml.com.cn/getSupportCity
sWebService_Url=http://www.webxml.com.cn/Webservices/WeatherWebService.asmx
sSOAP_Request= "<?xml version=""1.0"" encoding=""utf-8""?>" &_
 "<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/xmlSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">" &_
  "<soap:Body>" &_
    "<getSupportCity xmlns="http://WebXml.com.cn/">" &_
      "<byProvinceName>广东</byProvinceName>" &_
    "</getSupportCity>" &_
  "</soap:Body>" &_
 "</soap:Envelope>"
MsgBox sSOAP_Request
Set WinHttpReq=CreateObject("WinHttp.WinHttpRequest.5.1")
oWinHttpReq.Open "POST",sWebService_Url,False
oWinHttpReq.setRequestHeader "Content-Type",sContentType
oWinHttpReq.setRequestHeader "SOAPAction",sSOAPAction
oWinHttpReq.send sSOAP_Request
sXMLResponse=oWinHttpReq.ResponseText
print sXMLResponse
Set InputXmlDoc=CreateObject("Msxml2.DOMDocument")
oInputXmlDoc.LoadXML(sXMLResponse)
print oInputXmlDoc.childNodes(1).text
'Dim t
't="ssxml2."\"bc"
'MsgBox t

 

TAG:

 

评分:0

我来说两句

Open Toolbar