开发者

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

I want to send an XML to another Asp Classic page on the same domain. i am using following code for se开发者_如何学Pythonnding 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!


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜