将XML发布到经典asp页面并检索页面上的发布数据
要在经典asp页面上发布数据,我使用以下代码将XML发布到经典asp页面并检索页面上的发布数据,xml,vbscript,asp-classic,serverxmlhttp,Xml,Vbscript,Asp Classic,Serverxmlhttp,要在经典asp页面上发布数据,我使用以下代码 Dim-stringXML、httpRequest、postResponse stringXML=“5” 设置httpRequest=Server.CreateObject(“MSXML2.ServerXMLHTTP.6.0”) httpRequest.打开“POST”http://www.mywebpage/TestVBScript/RecieveRequest.asp”“是的 httpRequest.SetRequestHeader“内容类型”、
Dim-stringXML、httpRequest、postResponse
stringXML=“5”
设置httpRequest=Server.CreateObject(“MSXML2.ServerXMLHTTP.6.0”)
httpRequest.打开“POST”http://www.mywebpage/TestVBScript/RecieveRequest.asp”“是的
httpRequest.SetRequestHeader“内容类型”、“文本/xml”
httpRequest.sendstringxml
现在我想在recieverest.asp页面上获取stringXML值。这样我就可以处理XML并返回响应
任何帮助都将不胜感激。提前感谢Dim stringXML、httpRequest、postResponse
Dim stringXML, httpRequest, postResponse
stringXML = "<?xml version=""1.0"" encoding=""UTF-8""?><School><Class>5</Class></School>"
Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
httpRequest.Open "POST", "http://www.mywebpage/TestVBScript/RecieveRequest.asp", True
httpRequest.SetRequestHeader "Content-Type", "text/xml"
httpRequest.setRequestHeader "Content-Length", Len(stringXML)
httpRequest.Send stringXML
If httpRequest.status = 200 Then
TextResponse = httpRequest.responseText
XMLResponse = httpRequest.responseXML
StreamResponse = httpRequest.responseStream
Else
' Handle missing response or other errors here
End If
Set httpRequest = Nothing
stringXML=“5”
设置httpRequest=Server.CreateObject(“MSXML2.ServerXMLHTTP.6.0”)
httpRequest.打开“POST”http://www.mywebpage/TestVBScript/RecieveRequest.asp”“是的
httpRequest.SetRequestHeader“内容类型”、“文本/xml”
httpRequest.setRequestHeader“内容长度”,Len(stringXML)
httpRequest.sendstringxml
如果httpRequest.status=200,则
text响应=httpRequest.responseText
XMLResponse=httpRequest.responseXML
StreamResponse=httpRequest.responseStream
其他的
'在此处处理缺少响应或其他错误
如果结束
设置httpRequest=Nothing
不喜欢只使用代码的答案,请稍加解释。记住,这对每个人都有好处,不仅仅是OP。