java
Pulling NOAA Data with Axis
Filed in archive Programming by jason on October 15, 2005
BlogPicture
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

BlogPicture
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.


Related Entries:

Permalink: Pulling NOAA Data with Axis
Tags: NOAA  Axis 
Trackback: http://publish.creative-weblogging.com/publish/mt-tb.pl/10247
img Addthis img Ask img Blinklist img del.icio.us img Digg img Fark img Facebook img Google img Lycos img Ma.gnolia Add this page to Mister Wong Mr Wong img Netscape img Netvousz img Newsvine img Reddit img StumbleUpon img Slashdot img Tailrank img Technorati img Wink img Yahoo

Vote for Pulling NOAA Data with Axis:

  • Currently 9.00/10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Rating: 9.00 out of 2 vote(s) cast.
 
Subscribe
Share It
RSSrss
See all blog subscribe options
Google google
What is RSS?
Yahoo! yahoo
Addthis Subscribe using any feed reader!
Bloglines Bloglines
Newsletter

TwitterFollow us on Twitter!