Web Service for Middlebury Weather

I’ve finished coding a Web Service for retrieving weather information for Middlebury, VT. The service is available at http://web.middlebury.edu/systems/weather/Weather.asmx. Currently, the service supports six functions:

  • getConditions() – returns a text description of the weather
  • getDate() – returns the date/time of the last update
  • getHigh() – returns an integer value of the high temperature in degrees F
  • getIcon() – returns the relative name of an icon representing the conditions
  • getLow() – returns an integer value of the low temperature in degrees F
  • getNOAAUrl() – returns the full URL to the NOAA’s weather site for Middlebury

Because the NOAA requests that you not retrieve information more than once an hour, the information is cached locally until a new request comes in more than an hour after the cache file was last modified. You can use the getDate() function to find out when the cache file was last refreshed. Right now, the service only serves up information about Middlebury’s weather, but I could see expanding this to allow other locations to be requested based a parameter to the service constructor. This might be helpful in getting weather conditions for other campuses. The getIcon() function will return a value like “01.gif”, which is an image file in http://web.middlebury.edu/systems/weather/Images, but you could have your own set of weather icons for your service and just mapt he appropriate condition to 01.gif.

This is based on code written by Brett Wilhelm for the MiddCMS framework. I’ve modified the code so that the different pieces of information are chucked out into functions, but the underlying functionality is the same.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>