我遇到的问题是代码:
Set oXmlHTTP = CreateObject("Microsoft.XMLHTTP")
oXmlHTTP.Open "POST", "http://www.oursite.com/WebServices/ourService.asmx?WSDL", False
oXmlHTTP.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8"
oXmlHTTP.setRequestHeader "SOAPAction", "http://ourNameSpace/ourFunction"
SOAPRequest = _
"<?xml version=""1.0"" encoding=""utf-8""?>" &_
"<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" &_
"<soap12:Body>" &_
"<ourFunction xmlns=""http://ourNameSpace/"">" &_
"<var1>" & Session("userid") & "</var1>" &_
"<var2>" & Session("internetid") & "</var2>" &_
"</ourFunction>" &_
"</soap12:Body>" &_
"</soap12:Envelope>"
oXmlHTTP.send SOAPRequest
它执行并且没有错误,但我找不到任何输出,或者即使它存在也无法解析它 - 但在这两种情况下我都不知道它。
在进行调用之后,我应该如何解析返回的XML?
答案 0 :(得分:2)
你错过了:
Set xmlResp = oXmlHTTP.responseXML
这使您可以访问 Msxml2.DOMDocument 对象。 如何从中获取数据实际上取决于您的肥皂响应的格式。
应该看起来像这样:
<% Set nodes = xmlResp.getElementsByTagName("returnVal") %>
<ul>
<% For Each node in nodes %>
<li><%=node.text%></li>
<% Next %>
</ul>
另见:
答案 1 :(得分:0)