C
c676228
Hi all,
I wrote an asp program which can receive xml string from a client program if
they send me a xml in the body. It is OK.(Anthony Jones helped me) But now,
our client suggests that they are willing to send me xml string through a
field, say xml="<document>firstDoc doc</document>"
So I have to write a testing program to make sure that our server can take it.
Here is my client side testing program:
Set xmlDom=CreateObject("Microsoft.XMLDOM")
XMLDom.async =False
dim xmlhttp
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open
"POST","xxxx.com/select2007/xt_select2007_CompleteB2B_test.asp",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmltext="xml=<enrollment>firstDoc doc</enrollment>"
xmlhttp.send xmltext
...
Response.ContentType = "text/xml"
Response.Write xmlhttp.responsexml.xml
Set xmlhttp = nothing
so I have to use the following code on the server side:
Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.LoadXML Request("xml")
....
it seems Ok,(but one thing is very strange: the space between the text of
the node disappears when the xml string displayed in the broswer, it becomes
firstDocdoc somehow) even worse when my xml string becomes more complicated,
it's messed up.
say if I have some attribute in the node:
<enrollment productName="Select" orderID="200704251114527189" >
</enrollment>
so my xmtext will become
xmltext="xml=<enrollment productName='Select'
orderID='200704251114527189'></enrollment>"
or xmltext="xml=" & "<enrollment name=""" & "Betty Sun" & """>first
try</enrollment>"
In IE, it will give me error message:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then
click the Refresh button, or try again later.
XML document must have a top level element. Error processing resource
'http://localhost/1109selectserverhttp.asp'.
Or in FireFox, it will have:
XML Parsing Error: no element found
Location: http://localhost/1109selectserverhttp.asp
Line Number 1, Column 1:
Can you tell me how to deal with it in this case?
Betty
I wrote an asp program which can receive xml string from a client program if
they send me a xml in the body. It is OK.(Anthony Jones helped me) But now,
our client suggests that they are willing to send me xml string through a
field, say xml="<document>firstDoc doc</document>"
So I have to write a testing program to make sure that our server can take it.
Here is my client side testing program:
Set xmlDom=CreateObject("Microsoft.XMLDOM")
XMLDom.async =False
dim xmlhttp
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open
"POST","xxxx.com/select2007/xt_select2007_CompleteB2B_test.asp",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmltext="xml=<enrollment>firstDoc doc</enrollment>"
xmlhttp.send xmltext
...
Response.ContentType = "text/xml"
Response.Write xmlhttp.responsexml.xml
Set xmlhttp = nothing
so I have to use the following code on the server side:
Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.LoadXML Request("xml")
....
it seems Ok,(but one thing is very strange: the space between the text of
the node disappears when the xml string displayed in the broswer, it becomes
firstDocdoc somehow) even worse when my xml string becomes more complicated,
it's messed up.
say if I have some attribute in the node:
<enrollment productName="Select" orderID="200704251114527189" >
</enrollment>
so my xmtext will become
xmltext="xml=<enrollment productName='Select'
orderID='200704251114527189'></enrollment>"
or xmltext="xml=" & "<enrollment name=""" & "Betty Sun" & """>first
try</enrollment>"
In IE, it will give me error message:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then
click the Refresh button, or try again later.
XML document must have a top level element. Error processing resource
'http://localhost/1109selectserverhttp.asp'.
Or in FireFox, it will have:
XML Parsing Error: no element found
Location: http://localhost/1109selectserverhttp.asp
Line Number 1, Column 1:
Can you tell me how to deal with it in this case?
Betty