Navigation:  Advanced Topics > Web Services >

Weather Forecast Example

CDyne & the Weather

These guys have a set of Web Services that can be accessed for free and many that require a paid subscription.


All of our Web Service related example are going to use one of their free services "Weather".


If you go to this link, you will see that there are 3 methods available for this Web Service. The one I am going concentrate on is "GetCityForecastByZip". If you click on this, you can see that this WS can be consumed in 4 ways:


SOAP 1.1
SOAP 1.2


This page does a very good job of describing the Request and Response XML, so take a look before we run through the actual examples.


The Request Structure

If you look at the Method, you can see that our GetCityForecastByZIP requires only a ZIP code as the input parameter.


The Response Structure

The reason I chose this Web Service Method is that the response data is not too simple and not too complex. See the collapsed XML structure below. Enter this into your browser to see it "live".



So our Response XML contains


Success, ResponseText - tells you whether the call was ok or not
State, City, WeatherStationCity - gives you some basic information about the ZIP code requested
ForecastResult - this contains the next 7 days worth of weather.


Within <Forecast>, we have the following




This is pretty self-explanatory. Notice the mis-spelt <Desciption>. If you are going to be doing anything by hand, make sure you mis-spell this too!


This should set the scene the way we access this with Clover.