【问题标题】:Post XML to classic asp page and retrieve the post data on page将 XML 发布到经典的 asp 页面并检索页面上的发布数据
【发布时间】:2014-06-08 16:53:56
【问题描述】:

要在经典的 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 并发送回响应

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

【问题讨论】:

    标签: xml vbscript asp-classic serverxmlhttp


    【解决方案1】:
    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
    

    【讨论】:

    • 不喜欢只回答代码的问题,请稍加解释。请记住,这是为了每个人的利益,而不仅仅是 OP。
    猜你喜欢
    • 2011-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-03
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多