如何发送和接收XML请求到另一个ASP页面的经典? [英] How to Send and Receive XML request to another ASP classic page?

查看:329
本文介绍了如何发送和接收XML请求到另一个ASP页面的经典?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个XML发送到另一个ASP经典页面上的同一个域。我使用以下code发送XML

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

和我有以下code设置xmlget.asp接收XML:

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)

我运行code,但看不出有什么反映,我怎么会知道?而如果它是成功的,我想知道的XML,我不知道确切的属性从xmlDoc中加载!

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!

推荐答案

第一:你是不是发送XML。
可变信息只有一个简单的文本。尝试

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

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

第二:你为什么要使用Microsoft.XMLDOM代替MSXML2.DOMDocument?
我有MSXML2使用它,工作得很好。

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

这篇关于如何发送和接收XML请求到另一个ASP页面的经典?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆