Weather API-

Madison has the best summer days, could not get to this for a long time. But I made some progress to Mannar's information. First we will try to integrate the Weather information. Basic idea is to call weather wsdl information. There is plenty of documentation about this service at NWS. Basically for using the service for a basic use, we will need the xsd and wsdl information from parent website. NWS, National weather service uses a proprietary XML notation called NDFD xml.

NWS Overview

Above NWS overview is a sum-up of our discussion. One restriction of this service is, weather can be predicted only for a 12/24 hour window. Now let us turn our attention towards developing this consumer service.

For starters we will follow the Facade pattern for developing this client. Facade pattern is a design pattern where user is encapsulated from the internal components of a code base. In this situation we assume Mannar's request is going to provide a city/zipcode and expects a float value about the weather. Internal working of interaction with weather service is not a scope for this request. So mannar's request will interact with a facade to get information. Code for this Facade is

Facade

From the above code Facade accepts a string and boom it gets the result. The work horse in this case is the WeatherServiceClient. We will dissect this class, main method that is used by this class is

returnWeatherCommResult returnWeatherCommResult

If you look closely into the method, the main operating classes are  gov.weather.forecasts.xml.dwmlgen.schema.dwml.ProductType,gov.weather.forecasts.xml.dwmlgen.schema.dwml.WeatherParametersType, gov.weather.forecasts.xml.dwmlgen.wsdl.ndfdxml.NdfdXML, gov.weather.forecasts.xml.dwmlgen.wsdl.ndfdxml.NdfdXMLPortType;. All the setters in the method are totally customizable, but for the sake of quickness I have everything hard-coded. I will try to update this at the earliest.

This is the core of our discussion about interacting with the weather service. I will update more later this week. The take-aways from today's post is, when we develop a webservice, the weather service gives some good flavors for integration. I think that is something that will have to looked into.