Discussion:
XML HTTP POST Messaging
(too old to reply)
KEN
2007-06-21 23:26:18 UTC
Permalink
So I am just trying to test posting xml to a page and saving that xml
file to read later (see code) below. The problem is that nothing
runs or happens at all. I am not sure if its the getting of the doc or
the sending and I am not sure what to troubleshoot first. any help
would be great.

<script type="text/javascript">
var xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
xmlHttp.open("GET", "note.xml", false)
document.write(xmlHttp.open("GET", "note.xml", false))

xmlHttp.open("POST", "Default.asp", false)
xmlHttp.send(xmlDoc)
</script>
<%
Dim CREATE_FILE_DATE_NAME
set XML_DOCUMENT_TO_SAVE = Server.CreateObject("Microsoft.XMLDOM")
XML_DOCUMENT_TO_SAVE.async=false
XML_DOCUMENT_TO_SAVE.load(request)
CREATE_FILE_DATE_NAME = Date()
CREATE_FILE_DATE_NAME = Replace(CREATE_FILE_DATE_NAME, "/", "")
'Response.Write("E:\" & CREATE_FILE_DATE_NAME & ".xml")
XML_DOCUMENT_TO_SAVE.Save("E:\services\notes.xml")
%>
Alex Krawarik [MSFT]
2007-07-06 16:22:47 UTC
Permalink
You never call send() the first time, therefore you never actually get your
"note.xml" to begin with. Your code should look more like this:

<script>
var xmlHttp=new ActiveXObject("MSXML2.XMLHTTP.3.0");
xmlHttp.open("GET", "note.xml", false);
xmlHttp.send();

// note.xml is now loaded in responseText or responseXml.xml property if it
really is well formed

var xmlHttp2 = new ActiveXObject("MSXML2.XMLHTTP.3.0");
xmlHttp2.open("POST", "Default.asp", false);
xmlHttp2.send(xmlHttp.responseXml.xml);
</script>
Post by KEN
So I am just trying to test posting xml to a page and saving that xml
file to read later (see code) below. The problem is that nothing
runs or happens at all. I am not sure if its the getting of the doc or
the sending and I am not sure what to troubleshoot first. any help
would be great.
<script type="text/javascript">
var xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
xmlHttp.open("GET", "note.xml", false)
document.write(xmlHttp.open("GET", "note.xml", false))
xmlHttp.open("POST", "Default.asp", false)
xmlHttp.send(xmlDoc)
</script>
<%
Dim CREATE_FILE_DATE_NAME
set XML_DOCUMENT_TO_SAVE = Server.CreateObject("Microsoft.XMLDOM")
XML_DOCUMENT_TO_SAVE.async=false
XML_DOCUMENT_TO_SAVE.load(request)
CREATE_FILE_DATE_NAME = Date()
CREATE_FILE_DATE_NAME = Replace(CREATE_FILE_DATE_NAME, "/", "")
'Response.Write("E:\" & CREATE_FILE_DATE_NAME & ".xml")
XML_DOCUMENT_TO_SAVE.Save("E:\services\notes.xml")
%>
Loading...