Pulling NOAA Data with Axis
Filed in archive Programming on October 15, 2005
A project I've been working on needs to pull data from NOAA via web services. They don't have an incredible fancy API like Amazon does but they do have the Experimental National Digital Forecast Database XML Web Service and besides a few bugs here and there it works fine. When I pull data from this web service I'm using Apache Axis. Just go to the site and pull down the latest version and follow the documentation to get an environment setup.
In order to create a Java client with supporting JavaBeans all a user needs to do with Axis is execute the following:
MyLinuxServer> java --classpath commons-logging.jar;log4j-1.2.8.jar;wsdl4j.jar;axis.jar;commons-discovery.jar;jaxrpc.jar;saaj.jar org.apache.axis.wsdl.WSDL2Java http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl
This generates all the files that a developer would require to start pulling data from NOAA's web service. If a developer is not that experienced with web services and needs even more of a helping hand they can use the -- testCase option to generate a JUnit client side test case. This test case could be used by itself or referenced to further determine exactly how the client generated, by WSDL2Java, can be used.
One thing I will say about these Axis utilities is that they don't work perfectly 100% of the time. A developer has to dig sometimes to figure out where an error is coming from but I've found those instances few and far between. An example of this is the -- testCase option I mentioned above. With the NOAA web service WSDL2Java created a signature as follows to envoke one of the NOAA services:
binding.NDFDgen(new java.math.BigDecimal(0), new java.math.BigDecimal(0), gov.weather.www.forecasts.xml.DWMLgen.schema.DWML_xsd.ProductType.value1, java.util.Calendar.getInstance(), java.util.Calendar.getInstance(), new gov.weather.www.forecasts.xml.DWMLgen.schema.DWML_xsd.WeatherParametersType());The web service is looking for a date in the format of "2004-01-01T00:00:00" but java.util.Calendar.getInstance() we are trying to submit is not going to provide that format. Once this is changed the JUnit test case works as expected and all is well. A developer could then start pulling and parsing data.
In a future article I will talk about how to create a web service using Axis. The first time I did it I thought to myself "you mean that is it... I don't have to do anything else?" It was really simple.


Permalink: Pulling NOAA Data with Axis
Tags: NOAA Axis
Vote for Pulling NOAA Data with Axis:
|
Rating: 9.00 out of 2 vote(s) cast.
|
| RSS | |
|
| |
| Yahoo! |
|
| Addthis |
|
| Bloglines |
|
| Follow us on Twitter! |
Most Popular
AJAX
Application Development
Awards
Basics
Best of
Business
conference
Did you know
E-Commerce
Information About
Management
Misc
Mobile Devices
mobile phones
Monthly Contest
Personal
Programming
Quick introduction
Security
Service Oriented Architectures
