473,748 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capturing XML pages from Server

Hello all:

Again, let me thank everyone who has helped in the past. Can't wait till I
can help out with some advice of my own.

Now, I am building an app that wishes to retrieve the output of Google
Desktop. It is very simple, I wish to send an http request asking for the
results in XML. ( by adding &format=xml to the end of the url) i would like
to capture the response from the Google Desktop server, (on the local
machine) and save that file into memory, then write a text file from one of
the fields in the document like so:

Dim myDoc as xmldocument
Dim ofile as io.file
Dim owriter as streamwriter = ofile.createtex t(pathtotextfil e)
owriter.writeli ne(myDoc.docume ntelement.child nodes(0).childn odes(3).innerte xt.tostring())
owriter.flush()
My problem is getting the myDoc. I am unsure of how to 'capture' the
response from the server. In the first version, I was forced to call ie and
navigate, then use the WSHShell.SendKe ys() method to send an ALT, then DOWN,
DOWN,DOWN, DOWN, DOWN, ENTER,filename, Enter. This process is stupid, I
know, but the only thing i could figure out in my allotted time period. So
this method saved the xml document to disk, then I used a separate program
to open those files from disk, and perform the text-file writing.

So am I really far off by looking at the System.Web.dll? I was looking at
the HTTPResponse Class and the HTTPRequest Class, and thier associated help
in the MSDN library, but I am unsure of how to implement these classes to
accomplish my task.

Thanks ever so much.

Steve


Nov 19 '05 #1
4 1422
Look at the system.net.http webrequest & system.net.http webresponse objects
I use vb.net so

<untested code -- I'm unsure where the new keyword actually goes and all
that >
dim x as new system.net.http webrequest
dim y as system.net.http webresponse = x.getresponse(G OOGLE URL)

I'm not sure if this would work, but why not?

"Steve Wolfie" <st*********@co mmunity.nospam> wrote in message
news:OG******** ******@TK2MSFTN GP14.phx.gbl...
Hello all:

Again, let me thank everyone who has helped in the past. Can't wait till I can help out with some advice of my own.

Now, I am building an app that wishes to retrieve the output of Google
Desktop. It is very simple, I wish to send an http request asking for the
results in XML. ( by adding &format=xml to the end of the url) i would like to capture the response from the Google Desktop server, (on the local
machine) and save that file into memory, then write a text file from one of the fields in the document like so:

Dim myDoc as xmldocument
Dim ofile as io.file
Dim owriter as streamwriter = ofile.createtex t(pathtotextfil e)
owriter.writeli ne(myDoc.docume ntelement.child nodes(0).childn odes(3).innerte x
t.tostring()) owriter.flush()
My problem is getting the myDoc. I am unsure of how to 'capture' the
response from the server. In the first version, I was forced to call ie and navigate, then use the WSHShell.SendKe ys() method to send an ALT, then DOWN, DOWN,DOWN, DOWN, DOWN, ENTER,filename, Enter. This process is stupid, I
know, but the only thing i could figure out in my allotted time period. So this method saved the xml document to disk, then I used a separate program
to open those files from disk, and perform the text-file writing.

So am I really far off by looking at the System.Web.dll? I was looking at
the HTTPResponse Class and the HTTPRequest Class, and thier associated help in the MSDN library, but I am unsure of how to implement these classes to
accomplish my task.

Thanks ever so much.

Steve

Nov 19 '05 #2
Thanks for Clamps's informative inputs.

Hi Steve,

For the quesiton you mentioned, I think HttpWebRequest/HttpWebResposne will
be the reasonable choice. WE can use the HttpWebRequest to send get/post
request to the remote web resource and then read teh content from the
HttpWebResponse 's ResponseStream. If the response content is really XML
format, we can use XmlDocumetn.Loa d method to load content from the web
request's responseStream. Something like:

HttpWebRequest req =
WebRequest.Crea te("http://servername/appname/resource.res") as
HttpWebRequest;

HttpWebResponse rep = req.GetResponse () as HttpWebResponse ;

Stream stream = rep.GetResponse Stream();

XmlDocument doc = new XmlDocument();

doc.Load(stream );

.......

Please feel free to post here if you have anything unclear or further
question.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Clamps" <Cl****@Spamles s.com>
| References: <OG************ **@TK2MSFTNGP14 .phx.gbl>
| Subject: Re: Capturing XML pages from Server
| Date: Wed, 3 Aug 2005 16:21:04 -0500
| Lines: 64
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
| Message-ID: <#y************ **@tk2msftngp13 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: state.al.us 216.226.180.1
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1159 83
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Look at the system.net.http webrequest & system.net.http webresponse objects
| I use vb.net so
|
| <untested code -- I'm unsure where the new keyword actually goes and all
| that >
| dim x as new system.net.http webrequest
| dim y as system.net.http webresponse = x.getresponse(G OOGLE URL)
|
| I'm not sure if this would work, but why not?
|
|
|
| "Steve Wolfie" <st*********@co mmunity.nospam> wrote in message
| news:OG******** ******@TK2MSFTN GP14.phx.gbl...
| > Hello all:
| >
| > Again, let me thank everyone who has helped in the past. Can't wait
till
| I
| > can help out with some advice of my own.
| >
| > Now, I am building an app that wishes to retrieve the output of Google
| > Desktop. It is very simple, I wish to send an http request asking for
the
| > results in XML. ( by adding &format=xml to the end of the url) i would
| like
| > to capture the response from the Google Desktop server, (on the local
| > machine) and save that file into memory, then write a text file from one
| of
| > the fields in the document like so:
| >
| > Dim myDoc as xmldocument
| > Dim ofile as io.file
| > Dim owriter as streamwriter = ofile.createtex t(pathtotextfil e)
| >
|
owriter.writeli ne(myDoc.docume ntelement.child nodes(0).childn odes(3).innerte x
| t.tostring())
| > owriter.flush()
| >
| >
| > My problem is getting the myDoc. I am unsure of how to 'capture' the
| > response from the server. In the first version, I was forced to call ie
| and
| > navigate, then use the WSHShell.SendKe ys() method to send an ALT, then
| DOWN,
| > DOWN,DOWN, DOWN, DOWN, ENTER,filename, Enter. This process is stupid, I
| > know, but the only thing i could figure out in my allotted time period.
| So
| > this method saved the xml document to disk, then I used a separate
program
| > to open those files from disk, and perform the text-file writing.
| >
| > So am I really far off by looking at the System.Web.dll? I was looking
at
| > the HTTPResponse Class and the HTTPRequest Class, and thier associated
| help
| > in the MSDN library, but I am unsure of how to implement these classes
to
| > accomplish my task.
| >
| > Thanks ever so much.
| >
| > Steve
| >
| >
| >
| >
|
|
|

Nov 19 '05 #3
WOW!!! THANKS!!!

It works beautifully. Thank you so much for the help!!

Steve
"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:%2******** ********@TK2MSF TNGXA01.phx.gbl ...
Thanks for Clamps's informative inputs.

Hi Steve,

For the quesiton you mentioned, I think HttpWebRequest/HttpWebResposne
will
be the reasonable choice. WE can use the HttpWebRequest to send get/post
request to the remote web resource and then read teh content from the
HttpWebResponse 's ResponseStream. If the response content is really XML
format, we can use XmlDocumetn.Loa d method to load content from the web
request's responseStream. Something like:

HttpWebRequest req =
WebRequest.Crea te("http://servername/appname/resource.res") as
HttpWebRequest;

HttpWebResponse rep = req.GetResponse () as HttpWebResponse ;

Stream stream = rep.GetResponse Stream();

XmlDocument doc = new XmlDocument();

doc.Load(stream );

......

Please feel free to post here if you have anything unclear or further
question.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Clamps" <Cl****@Spamles s.com>
| References: <OG************ **@TK2MSFTNGP14 .phx.gbl>
| Subject: Re: Capturing XML pages from Server
| Date: Wed, 3 Aug 2005 16:21:04 -0500
| Lines: 64
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
| Message-ID: <#y************ **@tk2msftngp13 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: state.al.us 216.226.180.1
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1159 83
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Look at the system.net.http webrequest & system.net.http webresponse
objects
| I use vb.net so
|
| <untested code -- I'm unsure where the new keyword actually goes and all
| that >
| dim x as new system.net.http webrequest
| dim y as system.net.http webresponse = x.getresponse(G OOGLE URL)
|
| I'm not sure if this would work, but why not?
|
|
|
| "Steve Wolfie" <st*********@co mmunity.nospam> wrote in message
| news:OG******** ******@TK2MSFTN GP14.phx.gbl...
| > Hello all:
| >
| > Again, let me thank everyone who has helped in the past. Can't wait
till
| I
| > can help out with some advice of my own.
| >
| > Now, I am building an app that wishes to retrieve the output of Google
| > Desktop. It is very simple, I wish to send an http request asking for
the
| > results in XML. ( by adding &format=xml to the end of the url) i would
| like
| > to capture the response from the Google Desktop server, (on the local
| > machine) and save that file into memory, then write a text file from
one
| of
| > the fields in the document like so:
| >
| > Dim myDoc as xmldocument
| > Dim ofile as io.file
| > Dim owriter as streamwriter = ofile.createtex t(pathtotextfil e)
| >
|
owriter.writeli ne(myDoc.docume ntelement.child nodes(0).childn odes(3).innerte x
| t.tostring())
| > owriter.flush()
| >
| >
| > My problem is getting the myDoc. I am unsure of how to 'capture' the
| > response from the server. In the first version, I was forced to call
ie
| and
| > navigate, then use the WSHShell.SendKe ys() method to send an ALT, then
| DOWN,
| > DOWN,DOWN, DOWN, DOWN, ENTER,filename, Enter. This process is stupid,
I
| > know, but the only thing i could figure out in my allotted time
period.
| So
| > this method saved the xml document to disk, then I used a separate
program
| > to open those files from disk, and perform the text-file writing.
| >
| > So am I really far off by looking at the System.Web.dll? I was
looking
at
| > the HTTPResponse Class and the HTTPRequest Class, and thier associated
| help
| > in the MSDN library, but I am unsure of how to implement these classes
to
| > accomplish my task.
| >
| > Thanks ever so much.
| >
| > Steve
| >
| >
| >
| >
|
|
|

Nov 19 '05 #4
Thanks for your response and glad that it's of assistance. :-)

Good luck !

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Steve Wolfie" <st*********@co mmunity.nospam>
| References: <OG************ **@TK2MSFTNGP14 .phx.gbl>
<#y************ **@tk2msftngp13 .phx.gbl>
<#T************ **@TK2MSFTNGXA0 1.phx.gbl>
| Subject: Re: Capturing XML pages from Server
| Date: Thu, 4 Aug 2005 11:06:53 -0700
| Lines: 140
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.1433
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1433
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#$************ **@TK2MSFTNGP15 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 65-112-167-178.dia.cust.qw est.net 65.112.167.178
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1162 07
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| WOW!!! THANKS!!!
|
| It works beautifully. Thank you so much for the help!!
|
| Steve
| "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| news:%2******** ********@TK2MSF TNGXA01.phx.gbl ...
| > Thanks for Clamps's informative inputs.
| >
| > Hi Steve,
| >
| > For the quesiton you mentioned, I think HttpWebRequest/HttpWebResposne
| > will
| > be the reasonable choice. WE can use the HttpWebRequest to send get/post
| > request to the remote web resource and then read teh content from the
| > HttpWebResponse 's ResponseStream. If the response content is really XML
| > format, we can use XmlDocumetn.Loa d method to load content from the web
| > request's responseStream. Something like:
| >
| > HttpWebRequest req =
| > WebRequest.Crea te("http://servername/appname/resource.res") as
| > HttpWebRequest;
| >
| > HttpWebResponse rep = req.GetResponse () as HttpWebResponse ;
| >
| > Stream stream = rep.GetResponse Stream();
| >
| > XmlDocument doc = new XmlDocument();
| >
| > doc.Load(stream );
| >
| > ......
| >
| > Please feel free to post here if you have anything unclear or further
| > question.
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | From: "Clamps" <Cl****@Spamles s.com>
| > | References: <OG************ **@TK2MSFTNGP14 .phx.gbl>
| > | Subject: Re: Capturing XML pages from Server
| > | Date: Wed, 3 Aug 2005 16:21:04 -0500
| > | Lines: 64
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
| > | Message-ID: <#y************ **@tk2msftngp13 .phx.gbl>
| > | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: state.al.us 216.226.180.1
| > | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| > | Xref: TK2MSFTNGXA01.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:1159 83
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| > |
| > | Look at the system.net.http webrequest & system.net.http webresponse
| > objects
| > | I use vb.net so
| > |
| > | <untested code -- I'm unsure where the new keyword actually goes and
all
| > | that >
| > | dim x as new system.net.http webrequest
| > | dim y as system.net.http webresponse = x.getresponse(G OOGLE URL)
| > |
| > | I'm not sure if this would work, but why not?
| > |
| > |
| > |
| > | "Steve Wolfie" <st*********@co mmunity.nospam> wrote in message
| > | news:OG******** ******@TK2MSFTN GP14.phx.gbl...
| > | > Hello all:
| > | >
| > | > Again, let me thank everyone who has helped in the past. Can't wait
| > till
| > | I
| > | > can help out with some advice of my own.
| > | >
| > | > Now, I am building an app that wishes to retrieve the output of
Google
| > | > Desktop. It is very simple, I wish to send an http request asking
for
| > the
| > | > results in XML. ( by adding &format=xml to the end of the url) i
would
| > | like
| > | > to capture the response from the Google Desktop server, (on the
local
| > | > machine) and save that file into memory, then write a text file
from
| > one
| > | of
| > | > the fields in the document like so:
| > | >
| > | > Dim myDoc as xmldocument
| > | > Dim ofile as io.file
| > | > Dim owriter as streamwriter = ofile.createtex t(pathtotextfil e)
| > | >
| > |
| >
owriter.writeli ne(myDoc.docume ntelement.child nodes(0).childn odes(3).innerte x
| > | t.tostring())
| > | > owriter.flush()
| > | >
| > | >
| > | > My problem is getting the myDoc. I am unsure of how to 'capture'
the
| > | > response from the server. In the first version, I was forced to
call
| > ie
| > | and
| > | > navigate, then use the WSHShell.SendKe ys() method to send an ALT,
then
| > | DOWN,
| > | > DOWN,DOWN, DOWN, DOWN, ENTER,filename, Enter. This process is
stupid,
| > I
| > | > know, but the only thing i could figure out in my allotted time
| > period.
| > | So
| > | > this method saved the xml document to disk, then I used a separate
| > program
| > | > to open those files from disk, and perform the text-file writing.
| > | >
| > | > So am I really far off by looking at the System.Web.dll? I was
| > looking
| > at
| > | > the HTTPResponse Class and the HTTPRequest Class, and thier
associated
| > | help
| > | > in the MSDN library, but I am unsure of how to implement these
classes
| > to
| > | > accomplish my task.
| > | >
| > | > Thanks ever so much.
| > | >
| > | > Steve
| > | >
| > | >
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 19 '05 #5

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

Similar topics

3
3138
by: Dimitris | last post by:
I'm using ADO.NET to call a stored procedure that runs the "BACKUP" command on selected databases. Is there any way I can capture the text output of the stored proc and return it to ADO.NET for displaying in my application? When I run the stored procedure from SQL Query Analyzer, I get an output (in the messages tab) like: Processed 1496 pages for database 'OldBO', file 'TB_BackOffice_Data' on file 1. Processed 1 pages for database...
8
4158
by: Zvonko | last post by:
Hi! Is it possible to capture an event when user leaves the page and execute some code? Not when he closes the window. Any ideas?
4
2117
by: Sandy Bremmer | last post by:
I am wondering if the following can be accomplished with javascript (and if so, if you think javascript is an appropriate solution). I'm afraid my javascript skills lack. I need to build a hyperlink that includes the current web page URI. When clicked, the current page is then processed by a program. For example, it would look something like this: <a href="http://some.program.com/index.php?current-web-page-URI">text etc.</a>
33
5639
by: Joerg Schuster | last post by:
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: <fl> get rid of this limitation! if p.pattern.groups > 100: raise AssertionError( "sorry, but this version only supports 100 named groups"
1
1300
by: Brad | last post by:
Hello all. I'm trying to convert an application with a SQL Server 2000 back end and an Access front-end. The back end is fine. I'm just trying to give it a web front-end using ASP.NET. The problem is that since Access runs on the client machine, it gathers NT authentication information at the client and uses that to access the database. Is it possible to capture NT authentication information at the client through the browser for an...
14
2549
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the internet, they have to login. I want to be able to capture that login versus their Windows login because I need to know who they are from any computer rather than only their computer. Any ideas? Thanks
8
3957
by: Raj Thakkar | last post by:
Hi, I am currenty working on a site for intranet. I have a user control in the header of every page that will be displayed only if people with certain username are surfing the site. These lists of usernames is stored on the server side in a xml based file So what I am doing at the moment is inside the user control pageload method, i get the username of the current person logged in using HttpContext.Current.User.Identity.Name and if the...
10
6019
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My code is in C#/ASP.NET. TIA. Andrew.
0
8995
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
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9561
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
9254
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...
1
6799
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
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
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
2217
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.