classic asp xml receiver page doesn't receive the xml (or so it seems)
I am working on Classic ASP and was going through a possible solution of posting and reading开发者_JAVA百科 an xml. I read Tim's reply (which is pasted below) but this doesn't work for me. It seems xmlDoc.load(Request) doesn't load anything. What could be wrong here? I would very much appreciate a prompt response.
This is the posting page:
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
This is the receiving page:
Dim xmlDoc
Dim userName
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(Request)
userName = xmlDoc.documentElement.selectSingleNode("UserName").firstChild.nodeValue
Try this :
Dim objXmlRequest
Set objXmlRequest = Server.CreateObject("MSXML2.DOMDOCUMENT.3.0")
objXmlRequest.async = False
objXmlRequest.setProperty "ServerHTTPRequest", True
objXmlRequest.validateOnParse = True
objXmlRequest.preserveWhiteSpace = False
IF objXmlRequest.Load (Request) THEN
''' GET THE REQUEST FROM CLIENT
strQuery = "//" & "ActionName"
Set oNode = objXmlRequest.selectSingleNode(strQuery)
strActionName = oNode.Text
END IF
' The key is in the property set ... check ".setProperty "ServerHTTPRequest", True"
Bye, Martin.
精彩评论