tags:

views:

12

answers:

2

Hi, I am working on Classic ASP and was going through a possible solution of posting and reading 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
A: 

You can't feed the ASP Request object to xmlDoc.load(). Try using this instead:

xmlDoc.load(Request.BinaryRead(Request.TotalBytes))
Tomalak
A: 

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.

martin desaulniers