在经典asp中从另一个网站对ServerXMLHTTP post的调用接收xml [英] receiving xml from another website's call to ServerXMLHTTP post in classic asp
问题描述
我正在将 ASP 网页的两面都写到 ASP 网页对话中,其中原始网页将信息推送到接收网页,然后接收网页对其进行处理并发回响应.原始网页必须使用以下代码开始转换:
I am writing both sides of an ASP-webpage to ASP-webpage conversation in which the originating webpage pushes information to the receiving webpage which then processes it and sends back a response. The originating webpage must use the code below to start the converstation:
url = "www.receivingwebsite.comasp
eceivingwebpage.asp
information = "UserName=Colt&PassWord=Taylor&Data=100"
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/xml"
xmlhttp.send information
...然后接收页面中的 ASP 代码必须能够看到发送的信息.我已经尝试了我能想到的一切.信息不在请求对象的 querystring
或表单数组中(因为 content-type 是 text/xml
),我尝试将整个请求对象传递给 domdocument
通过其 load()
和/或 loadxml()
方法.
...and then somehow the ASP code in the receiving page has to be able to see the information that was sent. I have tried everything I can think of. The information is not in the request object's querystring
or form arrays (because the content-type is text/xml
) and I've tried passing the entire request object to a domdocument
via its load()
and/or loadxml()
methods.
无论我做什么,我都找不到信息,但我知道它正在发送,因为当我将内容类型更改为 application/x-www-form-urlencoded
时,我可以在 request.form
数组中看到它.
No matter what I do, I can't find the information but I know that it is being sent because when I change the content-type to application/x-www-form-urlencoded
, I can see it in request.form
array.
那么当内容类型为 text/xml
时,我的信息在哪里?
So where is my information when the content-type is text/xml
?
推荐答案
当您将内容类型设置为text/xml"时,您确实需要将信息作为 XML 字符串发送,而不是名称-值列表.
When you set the content-type to "text/xml" you really need to send the information as an XML string, not a name-value list.
url = "www.receivingwebsite.comasp
eceivingwebpage.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
然后,在您的接收 ASP 页面中,您将捕获 XML,如下所示:
Then, in your receiving ASP page, you would then capture the XML as follows:
Dim xmlDoc
Dim userName
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(Request)
userName = xmlDoc.documentElement.selectSingleNode("UserName").firstChild.nodeValue
这篇关于在经典asp中从另一个网站对ServerXMLHTTP post的调用接收xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!