Forum Moderators: open
set objXML = server.createobject("msxml2.serverxmlhttp")
set xmldom = server.CreateObject("msxml2.domdocument")
objXML.Open "POST","http://myserver/somepage.asp", False
objxml.setrequestheader "Accept-Language", "en"
objxml.setrequestheader "Connection","Keep-Alive"
objXML.setrequestheader "Content-Type","application/x-www-form-urlencoded"
objxml.send somexmlstring
so my question is in somepage.asp how to i read the xml that they posted?
Mac
right now im thinking the only solution is to have them do
objxml.send "xml=" & somexmlstring
then i can just load the dom through request.form but it doesnt seem like the right way to do it. I have posted this question on multiple different messageboards but nobody has been able to come up with an answer; like i said maybe asp just isnt suited for this?
The "objXML.Load" method will also most likely give you an error if you are streaming XML from a URL. You might want to try the following when streaming data from another server, data source, etc. This page could be used to process a request from a form or a direct link to a URL. I would call this page something like "xml_processing.asp".
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Dim objXML, objXmlDoc, strUrl, strDataStream, strXmlFile [b]' Check to see if you are loading file from a form[/b] strXmlFile = Request.Form("txtSomeXmlFile") If strXmlFile = "" Then Set objXML = Server.CreateObject("Msxml2.ServerXMLHTTP") [b]' Make sure we can get the data[/b] If IsObject(objXML) Then [b]' The page could be a straight forward page like sompage.asp[/b] 'strUrl = "somepage.asp" [b]' Or with some XML parameters attached to the QueryString[/b] strUrl = "somepage.asp?Cust=<customer>Joe Smith</customer>"
[b]' Secure open method with authentication[/b] 'objXML.Open "GET", strUrl, False, "Domain\Username", "Password" [b]' Open method without authentication[/b] objXML.Open "GET", strUrl, False objXML.Send() strDataStream = objXML.ResponseText Else Response.Write "Cannot make ServerXMLHTTP Object." End If End If [b]' Make sure we have data to read[/b] If strDataStream <> "" Then Set objXmlDoc = CreateObject("Msxml2.DOMDocument") objXmlDoc.Async = False objXmlDoc.ValidateOnParse = False objXmlDoc.ResolveExternals = False [b]' If the XML is being streamed from another source[/b] objXmlDoc.LoadXML(strDataStream) ElseIf strXmlFile <> "" Then [b]' If the XML is from the XML document strXmlFile[/b] 'objXmlDoc.load(strXmlFile) Else Response.Write "No XML data was able to be retrieved and parse! End If :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I have a VBScript that I use to traverse the XML document and use a Response.Write to write to the screen. If you'd like more info on it, reply back to this post and I'll post it.
Hope this gave some more insight on this. BTW...sorry for the lack of indenting, I could figure out how to acieve that.
Scott