xml - 将 XML 发布到经典 asp 页面并检索页面上的发布数据

标签 xml vbscript asp-classic serverxmlhttp

要在经典 asp 页面上发布数据,我使用下面的代码

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

现在我想获取 RecieveRequest.asp 页面上的 stringXML 值。这样我就可以处理我的 XML 并发回响应

任何帮助将不胜感激。提前致谢

最佳答案

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

关于xml - 将 XML 发布到经典 asp 页面并检索页面上的发布数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23251378/

相关文章:

asp.net-mvc - ASP.NET MVC 和 text/xml 内容类型

c# - 在没有对我的最终输出进行 HTML 编码的情况下使用 XSL 进行转换的属性方法是什么?

asp.net-mvc - 我们是否正在转向使用 .Net 3.5 中的 MVC 框架的经典 ASP?

asp-classic - 从 fso 对象创建 ado 记录集

c# - 将 XML 文件读入 TreeView

c# - 尝试写入 C# 的现有 XML 文件

vba - HTA 如何获取当前用户的用户名?

vbscript excel 创建工作表

c++ - Windows 脚本宿主在关闭创建的窗口时终止