Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Connecting to dynamically generated data

Reply
Thread Tools

Connecting to dynamically generated data

 
 
Derek
Guest
Posts: n/a
 
      08-19-2005
Hello all, this is my first time posting to a Usenet group, so please
forgive me for my "green-ness." Anyway, my problem is this: I need to
connect to a website that provides current and historical weather data
and does so through a web interface. To get the information you pass it
the type of data you want and a few constraints and the server
retrieves the data in plain text.

Here's an example:
http://nomads.ncdc.noaa.gov:9091/dod...00_fff.asc?tmp[0:0][0:6:25][0:180][0:359]

However, if I try to connect to the page with the following,

URL url = new
URL("http://nomads.ncdc.noaa.gov:9091/dods/NCEP_GFS/200506/20050616/gfs_3_20050616_0600_fff.ascii?tmp[0:0][0:6:25][0:180][0:359]");
InputStream stream = url.openStream();

I get the following Exception:
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.http://www.protocol.http.HttpURLConn...Stream(Unknown
Source)
at java.net.URL.openStream(Unknown Source)

Now, I've already set the proxy so that it can connect to outside web
pages (I've already tried it out on more mundane pages with no
problems), so I'm not sure what else I need to do to be able to connect
to it to retrieve the data. Can anyone help me out? Many thanks!

-Derek

 
Reply With Quote
 
 
 
 
Derek
Guest
Posts: n/a
 
      08-19-2005
Ugh, links got all screwed up. Try copying this:
nomads.ncdc.noaa.gov:9091/dods/NCEP_GFS/200506/20050616/gfs_3_20050616_0600_fff.asc?tmp[0:0][0:6:25][0:180][0:359]

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      08-19-2005
On 19 Aug 2005 11:34:38 -0700, Derek wrote:

> Hello all, this is my first time posting to a Usenet group, so please
> forgive me for my "green-ness."


Cool. First tip. Please repeat the key words of the subject
in the body of the post, as some people ignore
subject lines..

Sub: Connecting to dynamically generated data

'Dynamically generated', eh..? That could be the problem
(though I'm not sure).

>..Anyway, my problem is this: I need to
> connect to a website


Which one?

> http://nomads.ncdc.noaa.gov:9091/dod...00_fff.asc?tmp[0:0][0:6:25][0:180][0:359]


Oh right.. <http://www.noaa.gov/>
The weather folks, they have some interesting data.
They also seem relatively Java friendly..
<http://shovel.hpcc.noaa.gov/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=an d&format=builtin-long&sort=score&words=java>

Are you sure they do not already provide an API for providing
this data to Java processes?

> However, if I try to connect to the page with the following,
>
> URL url = new
> URL("http://nomads.ncdc.noaa.gov:9091/dods/NCEP_GFS/200506/20050616/gfs_3_20050616_0600_fff.ascii?tmp[0:0][0:6:25][0:180][0:359]");
> InputStream stream = url.openStream();
>
> I get the following Exception:
> java.net.SocketException: Unexpected end of file from server


I did a quick check here to the point of opening an input stream,
and got no errors. Are you sure the error indicated that *exact* line?

> ...so I'm not sure what else I need to do to be able to connect
> to it to retrieve the data.


I strongly recommend getting in touch with the noaa support, I
suspect that
a) the 'dynamic' nature of the information feed is the problem.
b) if they are OK with direct programmatic access, they will
either point you to the API designed to access it, or maybe point
you to the little FAQ that shows you the trick.

HTH

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"..I pick up all the pieces and make an island. Might even raise just a
little sand"
Jimi Hendrix 'Voodoo Chile (Slight Return)'
 
Reply With Quote
 
Derek
Guest
Posts: n/a
 
      08-19-2005
Thanks a bunch for the reply! I was hoping that because the data just
generates and presents itself if you try to access it through a web
browser that it would do the same when trying to connect to it through
Java. I'll try your suggestions, hopefully there is an API I can use.
Thanks again!

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      08-20-2005
On 19 Aug 2005 11:34:38 -0700, "Derek" <(E-Mail Removed)> wrote
or quoted :

>
>Now, I've already set the proxy so that it can connect to outside web
>pages (I've already tried it out on more mundane pages with no
>problems), so I'm not sure what else I need to do to be able to connect
>to it to retrieve the data. Can anyone help me out? Many thanks!


Tackle a simpler problem first, e.g. read a perfectly vanilla web
page.

Then get a packet sniffer. See
http://mindprod.com/jgloss/ethereal.html

Then get your browser to poke at the weather site, and watch the
interactions. That will help you understand what you have to do.

If you are stuck, I could write you a class to handle this for a fee.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Verifying data in dynamically generated text boxes Sethos Javascript 2 03-07-2006 03:35 PM
xmlhttprequest to get dynamically generated data seems to have a size limit ted benedict Javascript 24 01-19-2006 08:07 AM
Format data in dynamically generated columns from crosstab query joshblair ASP .Net Datagrid Control 4 01-16-2006 11:02 PM
Dynamically generated png images Chris Jones ASP .Net 1 06-27-2003 03:00 PM
.png doesn't work for dynamically generated images, but .jpeg and .gif does Chris Jones ASP .Net 0 06-25-2003 12:47 PM



Advertisments