473,396 Members | 2,011 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.

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.createtext(pathtotextfile)
owriter.writeline(myDoc.documentelement.childnodes (0).childnodes(3).innertext.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.SendKeys() 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 1403
Look at the system.net.httpwebrequest & system.net.httpwebresponse 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.httpwebrequest
dim y as system.net.httpwebresponse = x.getresponse(GOOGLE URL)

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

"Steve Wolfie" <st*********@community.nospam> wrote in message
news:OG**************@TK2MSFTNGP14.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.createtext(pathtotextfile)
owriter.writeline(myDoc.documentelement.childnodes (0).childnodes(3).innertex
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.SendKeys() 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.Load method to load content from the web
request's responseStream. Something like:

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

HttpWebResponse rep = req.GetResponse() as HttpWebResponse;

Stream stream = rep.GetResponseStream();

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****@Spamless.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: state.al.us 216.226.180.1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:115983
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Look at the system.net.httpwebrequest & system.net.httpwebresponse 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.httpwebrequest
| dim y as system.net.httpwebresponse = x.getresponse(GOOGLE URL)
|
| I'm not sure if this would work, but why not?
|
|
|
| "Steve Wolfie" <st*********@community.nospam> wrote in message
| news:OG**************@TK2MSFTNGP14.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.createtext(pathtotextfile)
| >
|
owriter.writeline(myDoc.documentelement.childnodes (0).childnodes(3).innertex
| 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.SendKeys() 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****************@TK2MSFTNGXA01.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.Load method to load content from the web
request's responseStream. Something like:

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

HttpWebResponse rep = req.GetResponse() as HttpWebResponse;

Stream stream = rep.GetResponseStream();

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****@Spamless.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: state.al.us 216.226.180.1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:115983
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Look at the system.net.httpwebrequest & system.net.httpwebresponse
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.httpwebrequest
| dim y as system.net.httpwebresponse = x.getresponse(GOOGLE URL)
|
| I'm not sure if this would work, but why not?
|
|
|
| "Steve Wolfie" <st*********@community.nospam> wrote in message
| news:OG**************@TK2MSFTNGP14.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.createtext(pathtotextfile)
| >
|
owriter.writeline(myDoc.documentelement.childnodes (0).childnodes(3).innertex
| 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.SendKeys() 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*********@community.nospam>
| References: <OG**************@TK2MSFTNGP14.phx.gbl>
<#y**************@tk2msftngp13.phx.gbl>
<#T**************@TK2MSFTNGXA01.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 65-112-167-178.dia.cust.qwest.net 65.112.167.178
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:116207
| X-Tomcat-NG: microsoft.public.dotnet.framework.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****************@TK2MSFTNGXA01.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.Load method to load content from the web
| > request's responseStream. Something like:
| >
| > HttpWebRequest req =
| > WebRequest.Create("http://servername/appname/resource.res") as
| > HttpWebRequest;
| >
| > HttpWebResponse rep = req.GetResponse() as HttpWebResponse;
| >
| > Stream stream = rep.GetResponseStream();
| >
| > 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****@Spamless.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.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: state.al.us 216.226.180.1
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:115983
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Look at the system.net.httpwebrequest & system.net.httpwebresponse
| > 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.httpwebrequest
| > | dim y as system.net.httpwebresponse = x.getresponse(GOOGLE URL)
| > |
| > | I'm not sure if this would work, but why not?
| > |
| > |
| > |
| > | "Steve Wolfie" <st*********@community.nospam> wrote in message
| > | news:OG**************@TK2MSFTNGP14.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.createtext(pathtotextfile)
| > | >
| > |
| >
owriter.writeline(myDoc.documentelement.childnodes (0).childnodes(3).innertex
| > | 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.SendKeys() 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
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...
8
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
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...
33
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...
1
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...
14
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...
8
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...
10
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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.