473,757 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.DOMDocume nt. 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 11574
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.DOMDocume nt. 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.Inp utStream 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@nowher e> wrote in message
news:OZ******** ******@TK2MSFTN GP12.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.DOMDocume nt. 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.Inp utStream 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.Strea mReader MyReader = new System.IO.Strea mReader
(Request.InputS tream,System.Te xt.Encoding.Uni code,false);

string MyDoc = MyReader.ReadTo End().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@nowher e> wrote in message
news:OZ******** ******@TK2MSFTN GP12.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.DOMDocume nt. 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
DOMDocumen t, 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.Stre am 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.Inp utStream 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.Strea mReader MyReader = new System.IO.Strea mReader
(Request.InputS tream,System.Te xt.Encoding.Uni code,false);

string MyDoc = MyReader.ReadTo End().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.DOMDocume nt. 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(Reques t.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
4639
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); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { document.myForm.outputSource.value = xmlhttp.responseText; } }
4
2415
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 and sends it to the server. On the server side I want to load/read this XML document.
5
17390
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. string get_url = "http://scmvs4:9090/gtccinfo/H485W020.HTML"; --url contains a form string post_url = "http://scmvs4:9090/cgi-bin/gticglnk/P485VEGA"; --called by get_Url upon submit
2
1292
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 StreamReader(strStranica, Encoding.ASCII); while ( (strLinija = sr.ReadLine()) != null ) { ....
1
2026
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 for any suggestions. My page has 10 tables with their visibility controlled by the user making a menu selection. For example, selecting menu_1 calls a function which displays table_1 by setting table_1's style display: block and hides tables...
3
2801
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 technology and really trying to learn. Thanks, Dan
4
1676
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 area it gives the following error Error Message:A potentially dangerous Request.Form value was detected from the client (lblpropertyDescription=" "). Stack Trace: at System.Web.HttpRequest.ValidateString(String s, String
2
3445
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. is there anything wrong in this code. ProcessLogin(string userName, string password) {
7
5747
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 to download the webpage programmatically i can't ever get the source XML, i always get the transformed html. Any ideas? I've tried everything i can think of :(
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10069
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9735
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.