MetSOAP

SOAP (Simple Object Access Protocol) is a standard developed by Microsoft, IBM and others for accessing web services using XML. MetSOAP is a SOAP-based web service providing software developers with consistent access to various online weather databases from a wide range of programming languages. This page provides descriptions of how MetSOAP works, and sample applications that you can run.

To get data from MetBroker, you need to do four things in general (examples in pseudocode):

  1. Initialize whatever SOAP Toolkit you are using, passing it a description of the MetSOAP web service eg:

    SOAPToolkit.init("http://www.agmodel.net/MetBroker/MetSOAP/MetSOAP.wsdl")
     
  2. Make a MetBroker request object that specifies what data you want, eg:

    request = CreateObject("MetSOAP.StationMetRequest")
    request.sourceID = "amedas"
    request.stationID = "40341"
    request.resolution = 1       {hourly data}
    request.elements =   [0,1,2] {air temperature, rain, and wind}
    request.interval = CreateObject (TimeInterval("2002/10/1","2002/10/31"))
    ...

     
  3. Send the request to MetBroker and receive back the results using a single function call eg:

    StationDataSet result = SOAPToolkit.getStationData(request)
     
  4. Extract the data you want from the result object

    ElementData[] elementArray = result.ElementData
    {This array has one element for each met element}


    For elementIndex = 0 To UpperBound(elementArray)
        DataStore[] thisElementsData = elementArray(elementIndex).Data
        {This array has elements for each element component
         eg wind speed and wind direction,
         or soil temperatures at 10cm, 50cm, and 1m,
         or daily air temperature max, min and mean}

       
        For elementDataStoresIndex = 0 To UpperBound(thisElementsData)
            Float[] storeContentsArray = thisElement.Data(elementDataStoresIndex).Contents
            {This array contains individual met readings for an element (eg max temperatures)
             There is one reading for each resolution step (eg each hour or each day)}

            For storeContentsIndex = 1 To UpperBound(storeContents)
                dataItem = storeContents(storeContentsIndex)
            End
        End
    End

Further information about MetSOAP, including API documentation is here.

Access and Status

You can check whether your organizational firewall lets you access MetSOAP and whether it is operational by clicking here.
If you can see a screen headed "Web Services"  with Port Name MetSOAP and Status ACTIVE then the server is accessible and it is operational.

Sample Clients

These sample clients show examples of how you can access MetSOAP from popular programming languages.

Microsoft SOAP Toolkit-based

The four Microsoft-based sample clients all require that you install the Microsoft SOAP Toolkit and a locally developed MetSOAP.DLL.

Step 1 - SOAP Toolkit and MetSOAP DLL installation

Follow these instructions to install the Microsoft SOAP Toolkit and MetSOAP.DLL

Excel Spreadsheet

This spreadsheet can extract weather data directly from databases around the world.
Installation instructions

VBScript

  1. Save MetSoapClient.vbs in a directory and run it.

Visual Basic 6

  1. Unzip this file in a directory.
  2. Run MetSoapVBClient in the same directory

ASP

  1. Set up IIS on your computer (if it isn't already)
  2. Save MetSoapClientVBS.asp in C:\inetpub\wwwroot or wherever you keep web pages for IIS.
  3. Open http://localhost/MetSoapClientVBS.asp in your web browser

Note that these clients all express times in the local time zone of your computer, as specified in the Windows clock control.
If you look at data from another time zone this may be confusing.

Java

Here is the source code of a short Java program that illustrates the use of MetSOAP. You can run this application by unzipping this file in any directory and executing runclient.bat in that directory.

To run the demo you need a recent copy of a Java runtime installed. You can download and install a Java runtime (JRE) from here.
(Note to run the demo you only need the smaller JRE version, not the full Software Development Kit (SDK).

WSDL file

The key file that describes the MetSOAP service is MetSOAP.wsdl. "wsdl" is short for "Web Services Definition Language" and this file contains a definition of the service that is readable by both SOAP tools and people. You can view wsdl files using Internet Explorer or other XML viewers.  To access the service described in these documents, you will need to have some SOAP tools for your particular programming language. Examples include the enterprise version of Delphi, the Microsoft SOAP Toolkit (freely available from Microsoft) for Visual Basic, ASP, Visual C++, and tools like GLUE. If you need help, tools are available from companies such as Cape Science (www.capescience.com) that will automatically generate VB or Java client applications from wsdl files.

SOAP Requests and Responses - Examples

This is an example of what a client application sends to MetSOAP: MetSOAPNorwayRequest.xml
This client requests four days of daily data - temperature, rain and wind.

Here is what MetSOAP sends back: MetSOAPNorwayResponse.xml

Return to the MetBroker home page