How to Send and Receive XML request to another ASP classic page?

老子叫甜甜 提交于 2019-12-25 02:44:43

问题


I want to send an XML to another Asp Classic page on the same domain. i am using following code for sending XMl

url = "http://localhost/api/xmlget.asp"
information = "<Send><UserName>Colt</UserName><PassWord>Taylor</PassWord><Data>100</Data></Send>"
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/xml" 
xmlhttp.send information

And i have setup xmlget.asp with following code to receive XML:

 Dim xmlDoc
 Dim userName
 set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
 xmlDoc.async="false"
 xmlDoc.load(Request)

I run the code but do not see any reflection, how would i know? And if it is successful I want to know the xml and i dont know exact property to load from xmlDoc!


回答1:


First: You are not sending XML. The variable information only have a simple text. Try

information = "<a>ColtTaylor100</a>"

Second: Why are you using Microsoft.XMLDOM instead of MSXML2.DOMDocument? I have use it with MSXML2 and worked fine.

Dim xmlDoc
set xmlDoc=Server.CreateObject("MSXML2.DOMDocument")
if not xmlDoc.load(Request) then
   Response.Write xmlDoc.parseerror.reason
   Response.End
end if


来源:https://stackoverflow.com/questions/2784759/how-to-send-and-receive-xml-request-to-another-asp-classic-page

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