receiving xml from another website's call to ServerXMLHTTP post in classic asp

前端 未结 1 1191
你的背包
你的背包 2021-01-16 15:12

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 an

相关标签:
1条回答
  • 2021-01-16 15:18

    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
    
    0 讨论(0)
提交回复
热议问题