all groups > dotnet xml > february 2005 >
You're in the

dotnet xml

group:

ASP to ASP.NET --- XMLHTTP error--XML document must have a top level element


ASP to ASP.NET --- XMLHTTP error--XML document must have a top level element juliankhan NO[at]SPAM hotmail.com
2/24/2005 7:42:36 AM
dotnet xml:
Hi

i am converting an ASP page to ASP.NET. The original ASP code works
perfectly but in ASP.NET i am getting the error "XML document must
have a top level element."

I have checked the XML being sent and it looks exactly the same as the
live (working version). The back end code has not changed at all.

The client side code is as follows:

Dim xmlhttp, WISERServer

WISERServer = "JK-VM1/production/Pages/XML.asp"

xmlhttp = CreateObject("MSXML2.XmlHttp.4.0")

xmlhttp.open("GET", WISERServer, False)
xmlhttp.setRequestHeader("Content-Type", "text/xml")

xmlhttp.send(oXML)

If (Err.Number = 0) Then


any help in converting this code to ASP.NET would be appreciated

Re: ASP to ASP.NET --- XMLHTTP error--XML document must have a top level element Dennis Myrén
2/24/2005 4:47:53 PM
Should'nt you use the POST method?

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
[quoted text, click to view]

Re: ASP to ASP.NET --- XMLHTTP error--XML document must have a top level element Martin Honnen
2/24/2005 4:55:06 PM


[quoted text, click to view]


[quoted text, click to view]

If you want to send data with the send method then you need
xmlhttp.open("POST", ...)
usually, a GET doesn't have a request body.

[quoted text, click to view]

What exactly do you want, you are talking about ASP to ASP.NET
conversion but then you post client-side code. It is not clear then what
you need help with.
If you want to write an ASP.NET page receiving POSTed XML then you need
to load the request stream e.g. C# pseudo code
XmlDocument requestXML = new XmlDocument();
try {
requestXML.Load(Request.InputStream);
}
catch (XmlException e) {
// handle errors here
}


--

Martin Honnen
Re: ASP to ASP.NET --- XMLHTTP error--XML document must have a top level element Dennis Myrén
2/24/2005 5:07:00 PM
It did not look like client-side code to me, really.
Anyway, i would hope this to be meant to be run at server side.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
[quoted text, click to view]

AddThis Social Bookmark Button