从另一个网站调用经典 asp 中的 ServerXMLHTTP post 接收 xml

发布于 2024-07-10 03:37:47 字数 810 浏览 11 评论 0原文

我正在编写 ASP 网页到 ASP 网页对话的双方,其中原始网页将信息推送到接收网页,然后接收网页对其进行处理并发回响应。 原始网页必须使用下面的代码来启动对话:

url = "www.receivingwebsite.com\asp\receivingwebpage.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 或表单数组中(因为内容类型是 text/xml),并且我尝试将整个请求对象传递给 < code>domdocument 通过其 load() 和/或 loadxml() 方法。

无论我做什么,我都找不到该信息,但我知道它正在发送,因为当我将内容类型更改为 application/x-www-form-urlencoded 时,我可以看到它位于 request.form 数组中。

那么,当内容类型为 text/xml 时,我的信息在哪里?

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.com\asp\receivingwebpage.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

...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.

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.

So where is my information when the content-type is text/xml?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初相遇 2024-07-17 03:37:48

当您将内容类型设置为“text/xml”时,您确实需要将信息作为 XML 字符串而不是名称值列表发送。

url = "www.receivingwebsite.com\asp\receivingwebpage.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,如下所示:

Dim xmlDoc
Dim userName
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(Request)
userName = xmlDoc.documentElement.selectSingleNode("UserName").firstChild.nodeValue

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.com\asp\receivingwebpage.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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文