473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Reading XML string from HttpRequest

I am having trouble getting the XML out of an HttpRequest object.

I am sending the XML from biztalk into my aspx page, after which I want to
take the XML out of it and process it using a MSXML.DOMDocument. I
understand that in the Request object, it is stored as a binary, and I can't
figure out how to translate it into a text string.

Do I need to read it into a byte variable and then move it to the
DOMDocument, or is there a method I can use to read it directly from the
Request? Maybe there is a better way to do this using one of the .NET
namespaces.

The code example that I am trying to translate into C# is using an
ADODB.Stream object and just changes the type from binary to text, after
which it can read it. The problem is that I don't want to have to register
all these 'old' dll's to make the ADODB work, there has to be a way to do
this in the .NET framework.

Thanks,
Daniel.
Nov 15 '05 #1
4 11554
Daniel Rimmelzwaan wrote:
I am having trouble getting the XML out of an HttpRequest object.

I am sending the XML from biztalk into my aspx page, after which I want to
take the XML out of it and process it using a MSXML.DOMDocument. I
understand that in the Request object, it is stored as a binary, and I can't
figure out how to translate it into a text string.

Do I need to read it into a byte variable and then move it to the
DOMDocument, or is there a method I can use to read it directly from the
Request? Maybe there is a better way to do this using one of the .NET
namespaces.

The code example that I am trying to translate into C# is using an
ADODB.Stream object and just changes the type from binary to text, after
which it can read it. The problem is that I don't want to have to register
all these 'old' dll's to make the ADODB work, there has to be a way to do
this in the .NET framework.

Thanks,
Daniel.


How is that XML document coming in? Is this as a value for a param? or
is this the only thing in the Post? If its the only thing coming in, you
can wrap the HttpRequest.InputStream with a StreamReader and use
ReadToEnd() on that StreamReader. That should get you the whole thing in
a "string".
Is this what you are looking for?

--
Girish Bharadwaj

Nov 15 '05 #2

"Girish Bharadwaj" <girishb@nowhere> wrote in message
news:OZ**************@TK2MSFTNGP12.phx.gbl...
Daniel Rimmelzwaan wrote:
I am having trouble getting the XML out of an HttpRequest object.

I am sending the XML from biztalk into my aspx page, after which I want to take the XML out of it and process it using a MSXML.DOMDocument. I
understand that in the Request object, it is stored as a binary, and I can't figure out how to translate it into a text string.

Do I need to read it into a byte variable and then move it to the
DOMDocument, or is there a method I can use to read it directly from the
Request? Maybe there is a better way to do this using one of the .NET
namespaces.

The code example that I am trying to translate into C# is using an
ADODB.Stream object and just changes the type from binary to text, after
which it can read it. The problem is that I don't want to have to register all these 'old' dll's to make the ADODB work, there has to be a way to do this in the .NET framework.

Thanks,
Daniel.


How is that XML document coming in? Is this as a value for a param? or
is this the only thing in the Post? If its the only thing coming in, you
can wrap the HttpRequest.InputStream with a StreamReader and use
ReadToEnd() on that StreamReader. That should get you the whole thing in
a "string".
Is this what you are looking for?

--
Girish Bharadwaj


The XML is passed from BizTalk into my aspx page, so I am assuming that is
what is in the HttpRequest. Using the StreamReader, it still shows the
binary stream, not the text itself. Here's the code I have:
System.IO.StreamReader MyReader = new System.IO.StreamReader
(Request.InputStream,System.Text.Encoding.Unicode, false);

string MyDoc = MyReader.ReadToEnd().ToString();

Response.Write(MyDoc);

The result is a big page of binary characters, not the XML that is sent to
the aspx page. It also does that when I don't have the ToString at the end
of the statement.
Nov 15 '05 #3
Daniel Rimmelzwaan wrote:
"Girish Bharadwaj" <girishb@nowhere> wrote in message
news:OZ**************@TK2MSFTNGP12.phx.gbl...
Daniel Rimmelzwaan wrote:

I am having trouble getting the XML out of an HttpRequest object.

I am sending the XML from biztalk into my aspx page, after which I want
to
take the XML out of it and process it using a MSXML.DOMDocument. I
understand that in the Request object, it is stored as a binary, and I
can't
figure out how to translate it into a text string.

Do I need to read it into a byte variable and then move it to the
DOMDocument, or is there a method I can use to read it directly from the
Request? Maybe there is a better way to do this using one of the .NET
namespaces.

The code example that I am trying to translate into C# is using an
ADODB.Stream object and just changes the type from binary to text, after
which it can read it. The problem is that I don't want to have to
register
all these 'old' dll's to make the ADODB work, there has to be a way to
do
this in the .NET framework.

Thanks,
Daniel.


How is that XML document coming in? Is this as a value for a param? or
is this the only thing in the Post? If its the only thing coming in, you
can wrap the HttpRequest.InputStream with a StreamReader and use
ReadToEnd() on that StreamReader. That should get you the whole thing in
a "string".
Is this what you are looking for?

--
Girish Bharadwaj

The XML is passed from BizTalk into my aspx page, so I am assuming that is
what is in the HttpRequest. Using the StreamReader, it still shows the
binary stream, not the text itself. Here's the code I have:
System.IO.StreamReader MyReader = new System.IO.StreamReader
(Request.InputStream,System.Text.Encoding.Unicode, false);

string MyDoc = MyReader.ReadToEnd().ToString();

Response.Write(MyDoc);

The result is a big page of binary characters, not the XML that is sent to
the aspx page. It also does that when I don't have the ToString at the end
of the statement.

Why dont you try allowing the StreamReader to recognize the byte order
and let it decide the encoding.. i.e. Just pass the inputstream into the
streamreader..
What happens then?

--
Girish Bharadwaj

Nov 15 '05 #4
"Daniel Rimmelzwaan" wrote:
I am having trouble getting the XML out of an HttpRequest object.

I am sending the XML from biztalk into my aspx page, after which I
want to take the XML out of it and process it using a
MSXML.DOMDocument. I understand that in the Request object, it is
stored as a binary, and I can't figure out how to translate it into
a text string.

Do I need to read it into a byte variable and then move it to the
DOMDocument, or is there a method I can use to read it directly from
the Request? Maybe there is a better way to do this using one of the
.NET namespaces.

The code example that I am trying to translate into C# is using an
ADODB.Stream object and just changes the type from binary to text,
after which it can read it. The problem is that I don't want to have
to register all these 'old' dll's to make the ADODB work, there has
to be a way to do this in the .NET framework.


Well, leaving behind all that old fashioned stuff such as MSXML, you can
basically do what you want in two lines of code:

// assuming we're in a code behind class or ASP.NET page
XmlDocument doc = new XmlDocument();
doc.Load(Request.Stream);

Now, you can manipulate the XML document using XmlDocument DOM API.

Cheers,
--
Joerg Jooss
jo*********@gmx.net
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: HikksNotAtHome | last post by:
In Mozilla 1.4b, when the URL is set to a local URL, it works as expected. function showIt(){ var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "blank.html" ,true);...
4
by: Serban | last post by:
Hi I have two applications(client and server) that pass an XML document but I have a hard time reading the XML document on the server side. So the client application creates the XML document...
5
by: Tammy | last post by:
Hi, I have an aspx app which needs to post data to a form and read the response. I am confused on whether I should be using the get_url using "POST" method or the post_url using "GET" method. ...
2
by: Neven Klofutar | last post by:
Hi, Is there a way I can read content of http page ? This won't work: **************************** string strStranica = @"http://www.hnb.hr/tecajn/hvazeca.htm"; StreamReader sr = new...
1
by: Gunnar | last post by:
I am finding some unusual behavior with techniques I am using to show/hide/update data without having to refresh the page. I'm quite sure it's developer ignorance on my part and would be grateful...
3
by: dmckeon | last post by:
I have a Javascript that is building an XML string and then invokes a JSP. I need to pass the XML string from the Javascript to the JSP. What's the best way to do that? I am new to this...
4
by: Vikas Kumar | last post by:
propertyDescription += "<br>" + lblpropertyDescription.Text; //here i am reading some text from text area i test wrting "p" in my text area it wrks fine but when i write <pin my text...
2
by: rbondalapati | last post by:
Hi I am trying to read xmlNode and validate user code used to do this is given below. i am able to load the XMLDocument. but the SelectSingleNode method call is always returning null value. ...
7
by: dakrin | last post by:
i'm trying to programatically read the xml that is used to create a webpage through xslt transformations. I can view the XML when i go to "View Source" in internet explorer, but whenever i try...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.