473,396 Members | 1,797 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,396 software developers and data experts.

Reading a XML on the server

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.

Any suggestions would be most welcome,

Thank you in advance

Serban
Nov 12 '05 #1
4 2402


Serban wrote:
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.


What server is that, IIS running ASP.NET? Is the XML sent with a HTTP
request?

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #2
Yes is an IIS server with ASp.net.
The XML is send(POST) using HTTPWebRequest / StreamWriter
Thank you

Serban
-----Original Message-----
Serban wrote:
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.
What server is that, IIS running ASP.NET? Is the XML sent

with a HTTPrequest?

--

Martin Honnen
http://JavaScript.FAQTs.com/

.

Nov 12 '05 #3

Hi

That is correct. I am using IIS with .Net application

Thank you

Serban
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #4


Serban wrote:
Yes is an IIS server with ASp.net.
The XML is send(POST) using HTTPWebRequest / StreamWriter
You can simply load the InputStream of the Request:

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Xml" %>
<script runat="server">
void Page_Load () {
XmlDocument postedXml = new XmlDocument();
postedXml.Load(Request.InputStream);
Response.Write("Found " + postedXml.GetElementsByTagName("*").Count +
" elements.");
}
</script>
The following posts some XML file to that ASP.NET page:

using System;
using System.IO;
using System.Net;

public class Test20030112 {
public static void Main (string[] args) {
HttpWebRequest httpRequest = (HttpWebRequest)
WebRequest.Create(@"http://localhost/javascript/test20031202.aspx");
httpRequest.Method = "POST";
httpRequest.ContentType = "text/xml";
FileStream fileStream = new FileStream(@"test20031202.xml",
FileMode.Open, FileAccess.Read);
byte[] requestBody = new byte[fileStream.Length];
fileStream.Read(requestBody, 0, (int) fileStream.Length);
httpRequest.ContentLength = requestBody.Length;
Stream requestStream = httpRequest.GetRequestStream();
requestStream.Write(requestBody, 0, requestBody.Length);
requestStream.Close();
HttpWebResponse httpResponse = (HttpWebResponse)
httpRequest.GetResponse();
Console.WriteLine(new
StreamReader(httpResponse.GetResponseStream()).Rea dToEnd());
}
}
-----Original Message-----
Serban wrote:
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.


What server is that, IIS running ASP.NET? Is the XML sent


with a HTTP
request?

--

Martin Honnen
http://JavaScript.FAQTs.com/

.


--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #5

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

Similar topics

9
by: javastudent | last post by:
Hi, I am implementing a server that reads for socket connections at a port, and processes the socket on a separate thread. We do not control the client implementation. Here is the scenario. ...
1
by: Boris Wilhelms | last post by:
Hello all, at first, sorry for my bad English, I’ll give my best  We have a strange problem reading Text- and VarChar-Fields. Our configuration: -Windows 2003 Server -MySQL Server 3.23.36...
4
by: JoelWhitehouse | last post by:
Hi! I want to write a script that will read a .php file on a remote server and print to the current page a portion of the text contained in the remote file. I am just wondering what the best...
1
by: Michael Palmer | last post by:
I'm reading xml from SQL Server 2K with VB.net using an XSD schema file and SQLXML 3.0. I have the below code working fine, but I'd like to change the code from reading the schema file from a...
21
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
3
by: Nelson R. | last post by:
Hi, im using a form to get some input from the user. This form is in a HTML file. When I post the form directly to my email, i receive all fields correctly. Example test.html: <FORM...
9
by: Mike Reed | last post by:
I must be having a "senile" day! I cannot recall, nor get to work, code to read a cookie's expiration date/time in an ASP page/VBScript. What am I missing? *** Sent via Developersdex...
12
by: SAL | last post by:
Hello, Is it possible to read a CSV from the Client, and bind my Datagrid to the data in the CSV file without uploading the file to the Server first? I have tried and in Debug mode on my...
5
by: xoise | last post by:
Warning: mysql_connect() : Lost connection to MySQL server at 'reading initial communication packet', system error: 113 in /webs/sites/monetized.com/includes/mysql_connect.inc.php on line 2 Lost...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.