从其他网站的呼叫接收XML来ServerXMLHTTP的帖子在传统的ASP [英] receiving xml from another website's call to ServerXMLHTTP post in classic asp
问题描述
我写一个ASP的网页到ASP-网页对话中,始发网页推信息到接收的网页,然后进行处理,并发送回一个响应的两侧。始发网页必须使用下面的code键启动converstation:
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
...然后以某种方式在接收页在ASP code的,以便能够看到,被发送的信息。我已经试过所有我能想到的。这些信息是不是在请求对象的查询字符串
或形式阵列(因为内容类型为文本/ XML
)和我试过路过整个请求对象到 DOM文档
通过其负荷()
和/或的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.
不管我做什么,我无法找到的资料,但我知道它正在发送,因为当我改变内容类型为应用程序/ x-WWW的形式urlen codeD
,我可以看到它在的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.
那么,是当内容类型为文本/ 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.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如下:
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
这篇关于从其他网站的呼叫接收XML来ServerXMLHTTP的帖子在传统的ASP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!