Web Services

Web Services

In an effort to increase distribution and use of the data collected by the NERRS, the Centralized Data Management Office has created several web service products for this purpose. These services can be used to pull real-time data from our databases for use by other individuals and organizations.

You must contact cdmowebmaster@belle.baruch.sc.edu for authorization before pulling data from the CDMO.

Transmission Time Schedule

  • Realtime satellite transmissions are received hourly based upon the diagram shown below. Decoding occurs at 11 minutes past the hour and 41 minutes past the hour. This data becomes available on the CDMO website at 15 and 45 minutes past the hour. Each transmission will have 4 15-minute records in it.

  • What does all this mean? Let's take Block #5 as an example. Three stations are transmitted in that block from 47:00 - 47:30 past the hour. The data from those stations will be decoded at 11 minutes past the hour and will be available on this website at 15 minutes past the hour.

  • What would be the best time to pull data from the website for Block #5?
    Answer: We recommend 16 or 17 minutes after the hour.

Transmission Times

Link to web service:

The web services URL: http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl

Web Service Functions:

  • exportStationCodesXMLNew (These functions return the same data as the original functions; however, they return tags with parameter names as opposed to having the data within the tags) - This function returns the following XML data: NERR_Site_ID, Station_Code, Station_Name, Latitude/Longitude (in degrees), Latitude (in decimal), Longitude (in decimal), Active Status, Active Dates, State, Reserve_Name, the parameters reported for all stations, and a Real Time bit.

  • NERRFilterStationCodesXMLNew (These functions return the same data as the original functions; however, they return tags with parameter names as opposed to having the data within the tags)- This function returns the following XML data: NERR_Site_ID, Station_Code, Station_Name, Latitude/Longitude (in degrees), Latitude (in decimal), Longitude (in decimal), Active Status, Active Dates, State, Reserve_Name, and the parameters reported for all stations associated with a particular NERR Site.

  • exportSingleParamXMLNew (These functions return the same data as the original functions; however, they return tags with parameter names as opposed to having the data within the tags) - This function returns the following XML data: DateTimeStamp, user-requested-parameter.

  • exportAllParamsDateRangeXMLNew (These functions return the same data as the original functions; however, they return tags with parameter names as opposed to having the data within the tags) - This function returns all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate.

  • exportAllParamsXMLNew (These functions return the same data as the original functions; however, they return tags with parameter names as opposed to having the data within the tags) - This function returns the following XML data: DateTimeStamp, and all parameters associated for requested station.
  • exportStationCodesXML - This function returns the following XML data: NERR_Site_ID, Station_Code, Station_Name, Latitude/Longitude (in degrees), Latitude (in decimal), Longitude (in decimal), Active Status, Active Dates, State, Reserve_Name, the parameters reported for all stations, and a Real Time bit.

  • NERRFilterStationCodesXML - This function returns the following XML data: NERR_Site_ID, Station_Code, Station_Name, Latitude/Longitude (in degrees), Latitude (in decimal), Longitude (in decimal), Active Status, Active Dates, State, Reserve_Name, and the parameters reported for all stations associated with a particular NERR Site.

  • exportSingleParamXML - This function returns the following XML data: DateTimeStamp, user-requested-parameter.

  • exportAllParamsDateRangeXML - This function returns all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate.

  • exportAllParamsXML -This function returns the following XML data: DateTimeStamp, and all parameters associated for requested station.

Function Arguments:

  • exportStationCodesXMLNew - No arguments required for this function.

  • NERRFilterStationCodesXMLNew - Only one parameter required: NERR Site ID.

  • exportSingleParamXMLNew - The user must supply 3 arguments: Station_Code, number of records to retrieve, and the parameter tested.

  • exportAllParamsDateRangeXMLNew - The user must supply 4 arguments: Station_Code, mindate, maxdate, and the parameter tested.

  • exportAllParamsXMLNew - The user must supply 2 arguments: Station_Code, and the number of records to retrieve (Max: 100 records).

  • exportStationCodesXML - No arguments required for this function.

  • NERRFilterStationCodesXML - Only one parameter required: NERR Site ID.

  • exportSingleParamXML - The user must supply 3 arguments: Station_Code, number of records to retrieve, and the parameter tested.

  • exportAllParamsDateRangeXML - The user must supply 4 arguments: Station_Code, mindate, maxdate, and the parameter tested.

  • exportAllParamsXML - The user must supply 2 arguments: Station_Code, and the number of records to retrieve (Max: 100 records).

Helpful Hints:

  • We recommend calling the exportStationCodesXML function first! This will give you the Station Codes for each station and the parameters reported for that station. Once you know what station and parameter data you want to pull, you will be able to format the arguments for the exportSingleParamXML function.

  • Flag codes can be returned for any parameter. The naming schema for the flag fieldname is F_parameter. Example flag column for pH is F_pH.

  • NOTE: If you are using NuSOAP version 0.9 or newer (Changelog of 2010 or newer) you may see receive an error to an undefined call. If you see this error you simply need to change the code where you assign the WSDL from the old syntax of:

    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');

    To the new syntax which is:

    $wsdl=new nusoap_client('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');

PHP, ColdFusion, and Perl Code Examples:

PHP Code Example:

  • In order for you to use PHP to call our web services, you must download NuSOAP here. Unzip the files and place them in a directory where your PHP file will be located on your web server.

  • Here is an example for calling the exportStationCodesXMLNew function:

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    $wsdl->call('exportStationCodesXMLNew');
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>


  • Here is an example for calling the exportStationCodesXML function:

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    $wsdl->call('exportStationCodesXML');
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>

  • Here is an example for calling the NERRFilterStationCodesXMLNew function to pull Station Code records for North Inlet Winyah Bay (NIW) Reserve:

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    $wsdl->call('NERRFilterStationCodesXMLNew', array('NERRFilter'=>'niw'));
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>

  • Here is an example for calling the NERRFilterStationCodesXML function to pull Station Code records for North Inlet Winyah Bay (NIW) Reserve:

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    $wsdl->call('NERRFilterStationCodesXML', array('NERRFilter'=>'niw'));
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>

  • Here is an example for calling the exportSingleParamXMLNew function to return the last 4 pH records from North Inlet Oyster Landing Water Quality Station niwolwq:

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    echo $wsdl->call('exportSingleParamXMLNew',
    array('tbl'=>'niwolwq','numrecs'=>'4','param'=>'pH'));
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>

  • Here is an example for calling the exportSingleParamXML function to return the last 4 pH records from North Inlet Oyster Landing Water Quality Station niwolwq:

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    echo $wsdl->call('exportSingleParamXML',
    array('tbl'=>'niwolwq','numrecs'=>'4','param'=>'pH'));
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>


  • Here is an example for calling the exportAllParamsDateRangeXMLNew function to return all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate. If you include a fieldlist, only those parameters will be returned to you.

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    echo $wsdl->call('exportAllParamsDateRangeXMLNew',
    array('tbl'=>'niwolwq','mindate'=>'12/06/2006','maxdate'=>'12/07/2007','fieldlist'=>'*'));
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>

  • Here is an example for calling the exportAllParamsDateRangeXML function to return all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate. If you include a fieldlist, only those parameters will be returned to you.

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    echo $wsdl->call('exportAllParamsDateRangeXML',
    array('tbl'=>'niwolwq','mindate'=>'12/06/2006','maxdate'=>'12/07/2007','fieldlist'=>'*'));
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>
  • Here is an example for calling the exportAllParamsXMLNew function to return all parameters for a certain station code.

    <?php require_once('lib/nusoap.php');
    $wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
    echo $wsdl->call('exportAllParamsXMLNew',
    array('tbl'=>'niwolwq','recs'=>'100'));
    echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
    ?>

Cold Fusion Code Example:

  • Here is an example for calling the exportStationCodesXMLNew function:

    <cfinvoke
    webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
    method="exportStationCodesXMLNew"
    returnvariable="aString">
    </cfinvoke>
    <!--- Output results --->
    <cfset aString = #XMLParse(aString)#>
    <cfdump var="#aString#">

  • Here is an example for calling the exportStationCodesXML function:

    <cfinvoke
    webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
    method="exportStationCodesXML"
    returnvariable="aString">
    </cfinvoke>
    <!--- Output results --->
    <cfset aString = #XMLParse(aString)#>
    <cfdump var="#aString#">

  • Here is an example for calling the NERRFilterStationCodesXMLNew function to pull Station Code records for North Inlet Winyah Bay (NIW) Reserve:

    <cfinvoke
    webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
    method="NERRFilterStationCodesXMLNew"
    returnvariable="aString">
    <cfinvokeargument name="NERRFilter" value="niw"/>
    </cfinvoke>
    <!--- Output results --->
    <cfset aString = #XMLParse(aString)#>
    <cfdump var="#aString#">

  • Here is an example for calling the NERRFilterStationCodesXML function to pull Station Code records for North Inlet Winyah Bay (NIW) Reserve:

    <cfinvoke
    webservice="http://cdmo.baruch.sc.edu/webservices/webservices2/requests.cfc?wsdl"
    method="NERRFilterStationCodesXML"
    returnvariable="aString">
    <cfinvokeargument name="NERRFilter" value="niw"/>
    </cfinvoke>
    <!--- Output results --->
    <cfset aString = #XMLParse(aString)#>
    <cfdump var="#aString#">

  • Here is an example for calling the exportSingleParamXMLNew function to return the last 4 pH records from North Inlet Oyster Landing Water Quality Station niwolwq:

    <cfinvoke
    webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
    method="exportSingleParamXMLNew"
    returnvariable="aString">
    <cfinvokeargument name="station_code" value="niwolwq"/>
    <cfinvokeargument name="recs" value="4"/>
    <cfinvokeargument name="param" value="pH"/>
    </cfinvoke>
    <!--- Output results --->
    <cfset aString = #XMLParse(aString)#>
    <cfdump var="#aString#">

  • Here is an example for calling the exportSingleParamXML function to return the last 4 pH records from North Inlet Oyster Landing Water Quality Station niwolwq:
    <cfinvoke
    webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
    method="exportSingleParamXML"
    returnvariable="aString">
    <cfinvokeargument name="station_code" value="niwolwq"/>
    <cfinvokeargument name="recs" value="4"/>
    <cfinvokeargument name="param" value="pH"/>
    </cfinvoke>
    <!--- Output results --->
    <cfset aString = #XMLParse(aString)#>
    <cfdump var="#aString#">

  • Here is an example for calling the exportAllParamsDateRangeXMLNew function to return all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate. If you include a fieldlist, only those parameters will be returned to you.

    <cfinvoke
    webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
    method="exportAllParamsDateRangeXMLNew"
    returnvariable="aString">
    <cfinvokeargument name="station_code" value="niwolmet"/>
    <cfinvokeargument name="mindate" value="12/12/2006"/>
    <cfinvokeargument name="maxdate" value="12/13/2006"/>
    <cfinvokeargument name="param" value="*"/>
    </cfinvoke>
    <!--- Output results --->
    <cfset aString = #XMLParse(aString)#>
    <cfdump var="#aString#">

  • Here is an example for calling the exportAllParamsDateRangeXML function to return all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate. If you include a fieldlist, only those parameters will be returned to you.

    <cfinvoke
    webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
    method="exportAllParamsDateRangeXML"
    returnvariable="aString">
    <cfinvokeargument name="station_code" value="niwolmet"/>
    <cfinvokeargument name="mindate" value="12/12/2006"/>
    <cfinvokeargument name="maxdate" value="12/13/2006"/>
    <cfinvokeargument name="param" value="BP"/>
    </cfinvoke>
    <!--- Output results --->
    <cfset aString = #XMLParse(aString)#>
    <cfdump var="#aString#">

Perl Code Example:

  • Here is an example for calling the exportAllParamsXML function.

    ################
    use strict;
    use SOAP::Lite;

    my $num_recs = @ARGV[0];
    my $output_dir = @ARGV[1];

    print("num_recs = $num_recs\n");
    print("output_dir = $output_dir\n");

    my @station_list = ('niwolmet','niwolwq');
    my ($endpoint, $uri, $method);
    $endpoint = "http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl";
    $uri = "http://tempuri.org";
    $method = 'exportAllParamsXML';

    my $station_id = '';
    foreach $station_id (@station_list)
    {
    print $station_id . "\n";
    my $filename = "$output_dir/cdmo_$station_id";
    my $file_out = $filename . '.txt';
    my $fh;
    open($fh, ">$file_out") or die("Failed to open file $file_out");

    #note: below method call may falsely return 'no operation' for a given method if the parameters are incorrect - also had to force string type in below call to avoid error

    my $soap = SOAP::Lite
    ->uri($uri)
    ->proxy($endpoint)
    ->outputxml(1);

    my $response = $soap->$method(SOAP::Data->name(station_code => "$station_id"),SOAP::Data->name(recs => "$num_recs")->type('string'));

    print $fh $response;
    print 'All Parameter Response: '.$response."\n";
    close($fh);

    open($fh, "< $file_out") or die("Failed to open file $file_out");

    ...
    }

 

Department of Commerce | NOAA | National Ocean Service | Office for Coastal Management | NERRS | Webmaster
Site hosted by NOAA’s National Estuarine Research Reserve System, Centralized Data Management Office.