consuming SOAP web services in classic ASP

血红的双手。 提交于 2019-12-31 00:57:24

问题


I have a problem with this is code:

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

It executes and gives no error, but I can't find any output, or I can't parse it even if it exists - but in both cases I don't know about it.

After doing the call, how am I supposed to get the parsing of returned XML?


回答1:


You're missing the:

Set xmlResp = oXmlHTTP.responseXML

This gives you access to an Msxml2.DOMDocument object. How you get the data from that really depends on the format of your soap response.

It should probably look something like this:

<%    Set nodes = xmlResp.getElementsByTagName("returnVal") %>
<ul>
<%    For Each node in nodes    %> 
   <li><%=node.text%></li>
<%    Next    %>
</ul>

See also:

  • DomDocument
  • ServerXMLHTTP
  • Using ServerXMLHTTP



回答2:


Consuming web services in classic asp



来源:https://stackoverflow.com/questions/1079356/consuming-soap-web-services-in-classic-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!