Web Services:Assignment One

Value20%
Due Date: 5pm 4 October 2004

Brief:

The Australian Bureau of Meteorology has a number of automatic weather stations located in Victoria. The  hourly observations  from the weather stations are are recorded into a plain text file ( ref. no. IDY03023 ). The document is available from  the Bureau's Web page :  " Latest Observations from Victoria (hourly update)" .

The following information is used to extract the data from the fields of the IDY03023 report.

      station	     =  substring(0,12);
      latitude	     =  substring(12,14)+"."+strLine.substring(14,16);
      longitude      =  substring(17,20)+"."+strLine.substring(20,22);
      day	     =  substring(22,26);
      time	     =  substring(26,30);
      windDir	     =  substring(37,40);
      windSpeedKnot  =  substring(41,45);
      tempC	     =  substring(45,47);
      relHumidity    =  substring(48,50);
      barPressurehPa =  substring(51,59);
      rain	     =  substring(59,62);
      rainPeriodValue = substring(63,65);
      weather	     =  substring(67,71);

Modify the Java programs from Web Services - Lab 06 to obtain a copy of the data file and extract the data fields into an XML document.

You can read from a remote file using http in a java program by using the URL & HttpURLConnection classes as follows:

import java.net.*;
import java.io.*;
import java.util.Properties;

   ..
   BufferedReader in;
   ..

   Properties properties = System.getProperties();
   properties.put("http.proxyHost", "proxy.latrobe.edu.au");
   properties.put("http.proxyPort", "8080");

   String url = "http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDY03023.txt";

   try{
      URL infileURL = new URL( url );
      HttpURLConnection connection=
         (HttpURLConnection)(infileURL.openConnection());
      
      in = new BufferedReader(new InputStreamReader(connection.getInputStream()))


      // use in.readLine() as usual to read in a line of text
      // use subtring() method of String to extract individual fields

   ..

Assignment tasks:

  1. Write a java application to read from the Australian Bureau of Meteorology's Latest Observations from Victoria (hourly update) and produce an XML document representing the data.
  2. You are required to plan the content and structure the XML document by designing a DTD to describe the XML document.

    Where appropriate, use attributes to represent the units of each field.
  3. Validate the XML document against the DTD.
  4. Design a single XSL style sheet that uses java.org.apache.xalan.xslt.Process to perform all the following transformations to produce an HTML document:

    If you wish to try this at home you will need to download xerces and xalan from http://www.apache.org/ and install the packages into your java ext folder.

    1. Display the number of log entries in the XML document.
    2. Display the most recent observations as an HTML table in ascending order of station name. IE. if a station has two entries, display the latest observation.
    3. Not all observations are recorded at same time. For each group observations that were recorded at the same time, generate an HTML table ordered by station number and calculate the highest, lowest and average temperature for each set.

      Each table for part(c) the table should only contain columns for station, time, day, temperature and humidity.
    4. Create an HTML table for only those stations in our area ( latitude 35.3 to 37 and longitude 142.5 to 145.5 ) ordered on station name with columns for station, time, day, temperature, humidity, barometric pressure, rainfall and weather.

Submission Requirements

Note: