You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Introduction

The Tomcat Fews PI service is hosted in a Tomcat service container. This service allows SOAP clients to interact with a FewsPiService that is connected to a FEWS system through the FEWS DataAccessComponent. With this API the SOAP client can retrieve data from the FEWS system. Before a client application can access the FEWS system there is some configuration work that needs to be done.

Tomcat Fews PI Service API

Description of the methods provided by the Embedded Fews PI Service API.

Getter methods

String getTimeZoneId(String piVersion);

Get ID of Configured timezone for the webservice.

  • clientId: <id not used>
  • returns: String representation of time zone.
String getFilters(String filterId, String piVersion);

Retrieve Pi Filters configuration from the Fews instance hosting the current FewsPiService.

The PiVersion defines the format of the return file content. If omitted the
latest version of the Pi file format will be used. (Expected 1.9 or higher)

  • filterid: Subset filter id. (optional).
  • piVersion: File format version (optional).
  • returns: PiFilters xml file content.
String getLocations(String clientId, String filterId, String piVersion);

Retrieve Pi Locations file containing all locations that are available for the passed 'filterId' argument.
If argument 'null' is passed then all locations configured in the pre-defined filter will be returned.
The PiVersion defines the format of the return file content. If omitted the latest version of the Pi file format will be used. (Expected 1.9 or higher).

  • clientId <id not used>.
  • filterId Filter id (optional).
  • piVersion File format version (optional)
  • returns PiLocations XML file content.
String getParameters(String clientId, String filterId, String piVersion);

Retrieve Pi Parameters file containing all parameters that are available for the passed 'filterId' argument.
If argument 'null' is passed then all parameters configured in the pre-defined filter will be returned.
The PiVersion defines the format of the return file content. If omitted the latest version of the Pi file format will be used. (Expected 1.9 or higher).

  • clientId <id not used>.
  • filterId Filter id (optional).
  • piVersion File format version (optional)
  • returns PiTimeSeriesParameters XML file content.
String getTimeSeriesHeadersForFilter(String clientId, Date startTime, Date timeZero, Date endTime, String filterId, String[] locationIds, String[] parameterIds, boolean useDisplayUnits, String piVersion);

Read the timeseries header information from the webservice. Returns a pi timeseries xml file containing the timeseries headers information belonging to the filter defined by the 'filterId'.
Retrieve the timeseries data using the method getTimeSeriesForFilter

The PiVersion defines the format of the return file content. If omitted the latest version of the Pi file format will be used. (Expected 1.9 or higher).

  • clientId <id not used>.
  • startTime start date/time of run.
  • timeZero Forecast time zero. If missing System time is used (optional)
  • endTime end date/time of run.
  • filterId Filter id (optional).
  • locationIds Subset of locations for which to retrieve timeseries (optional).
  • parameterIds Subset of parameters for which to retrieve timeseries (optional).
  • useDisplayUnits Export values using display units (optional).
  • piVersion File format version (optional)
  • return PiTimeseries xml file content.
String getTimeSeriesForFilter(String clientId, Date startTime, Date timeZero, Date endTime, String filterId, String[] locationIds, String[] parameterIds, boolean convertDatum, boolean useDisplayUnits, String piVersion);

Returns a pi timeseries xml file containing the timeseries data belonging to the filter defined by the 'filterId'.
The 'convertDatum' argument is to allow timeseries that support a global datum to have their values converted from a value relative to the location height to an absolute value.

The PiVersion defines the format of the return file content. If omitted the latest version of the Pi file format will be used. (Expected 1.9 or higher).

  • clientId <id not used>.
  • startTime start date/time of run.
  • timeZero Forecast time zero. If missing System time is used (optional)
  • endTime end date/time of run.
  • filterId Filter id (optional).
  • locationIds Subset of locations for which to retrieve timeseries (optional).
  • parameterIds Subset of parameters for which to retrieve timeseries (optional).
  • convertDatum Convert values from relative location height to absolute height values (optional).
  • useDisplayUnits Export values using display units (optional).
  • piVersion File format version (optional)
  • return PiTimeseries xml file content.

Setter methods

void putTimeSeriesForFilters(String clientId, String piTimeSeriesXmlContent, byte[] piTimeSeriesBinaryContent, boolean convertDatum);

 Write timeseries data to the FEWS system using the timeseries sets defined by the filters.

For performance reasons it is possible to split the timeseries header information from the timeseries data. The header information is stored in the piTimeSeriesXmlContent and the timeseries data is stored in the piTimeSeriesBinaryContent. If both header information and data is stored in the XML content the the 'piTimeSeriesBinaryContent' argument can be null.

The 'convertDatum' argument is to allow timeseries that support a datum to have their values converted to a value
relative to the location height. If values are already relative to location then enter FALSE or omit.

  • clientId <id not used>.
  • piTimeSeriesXmlContent PiTimeseries xml file content
  • piTimeSeriesBinaryContent FastInfoSet PiTimeseries file content(optional)
  • convertDatum Convert values from relative location height to absolute height values (optional).

Installing a Tomcat Fews PI Service

The file [^DAC installation guide (final).doc] describes how to install a Tomcat instance containing a DataAccessComponent instance. Once these steps are completed the FewsPiService.WAR can be deployed using a context xml file such as [^FewsPiService.xml]

Configuration

The are two levels of configuration. The first is the DataAccessComponent which is a FEWS client hosted as a GlobalResource in Tomcat. The DataAccessComponent uses the regular FEWS configuration which falls outside the scope of this documentation. The second level of configuration is what is used by the FewsPiService webservice which has been deployed in Tomcat. To deploy this webservice a context XML file is required which looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!-- Location of specific AI war file. (Can be a symlink) -->
<Context docBase="${catalina.home}/fews/FewsPiService.war" antiJARLocking="true" crossContext="true" >
    <!—- 'clientConfigFileId' points to a FEWS configuration file in de FEWS configuration directory 'PiClientConfigFiles'. -->
     <Parameter name="clientConfigFileId" value="FewsPiService.properties" override="false"/>
    <!—- resourceId must match the 'name' of 'ResourceLink' below -->
     <Parameter name="resourceId" value="resourcelink_name" override="false"/>
     <Parameter name="serviceName" value="FewsPiService" override="false"/>
     <Parameter name="namespaceUri" value="http://fewpiservice.wldelft.nl" override="false"/>
     <Parameter name="portName" value="FewsPiServicePort" override="false"/>
    <!—-  'fewspi_config_naam' must match the file name of this configuration file without the XML extension. -->
     <Parameter name="wsdl" value="http://localhost:<port>/fewspi_config_name/fewspiservice?wsdl" override="false"/>
    <!—-  make 'resoucelink_name'  equal to the  'resoucelink_name' described by resource id above. 'global_resource_name' must be the same as the DAC resource name in the file 'server.xml'-->
     <ResourceLink name="resoucelink_name"
                  global="global_resource_name"
                  type="nl.wldelft.fews.system.data.dac.DataAccessComponent"/>
     <Loader loaderClass="nl.wldelft.fews.system.data.dac.DacClassLoader" delegate="true"/>
</Context>

In the above configuration example you see a number of 'Parameter' values which will be explained below:

  • clientConfigFileId = This is a reference to a FEWS configuration file. With this file it is possible to configure the webservice instance. We will discuss this file in more detail below. The field is optional. If omitted then the defaultFilterId must be configured in the Filters.xml FEWS configuration file.
  • resourceId = Tells the webservice what Tomcat resource link to use.

The next parameters have been added for the FewsPiService test page. This is the page that appears when browsing to the root URI of the FewsPiService. Technically these parameters would not be required, but because it is a 'test' page, the configuration has not been optimized yet.

  • serviceName = Name of the service
  • namespaceUri = Namespace of the service
  • portName = Name of the service port
  • wsdl = URI of the service WSDL file

FEWS Client Config File (clientConfigFileId)

This is a simple text configuration file that is located in the FEWS configuration in the directory:

_

Unknown macro: {REGION_HOME}

/Config/PiClientConfigFiles_/FewsPiService.properties

In the above example the clientConfigFileId would be FewsPiService.properties.

This properties file can contain the following configuration items:

\# This file must be placed in the FEWS configuration folder Config/PiClientConfigFiles.
\# It is referenced by the FewsPiService webservice through the parameter 'clientConfigFileId' in the service context.xml file.
\# Note that all id references are case sensitive.

\# This element defines the root filter id for the webservice (type = string).
\# If omitted the FewsPiService will try to retrieve the defaultFilterId from the Filters.xml.
FILTER_ID=My_FilterId

\# Identifier of the flag conversion file to use when extracting timeseries from the FewsPiService (type = string).
\# If omitted no flag conversion takes place
EXPORT_FLAGCONVERSION_ID=My_Export_FlagConversion

\# Identifier of the unit conversion file to use when extracting timeseries from the FewsPiService (type = string).
\# If omitted no unit conversion takes place
EXPORT_UNITCONVERSION_ID=My_Export_UnitConversion

\# Identifier of the id map file to use when extracting timeseries from the FewsPiService (type = string).
\# If omitted no id mapping takes place
\#EXPORT_IDMAP_ID=My_Export_IdMap

\# Identifier of the unit conversion file to use when writing timeseries to the FewsPiService (type = string).
\# If omitted no unit conversion takes place
IMPORT_UNITCONVERSION_ID=My_Import_UnitConversion

\# Identifier of the id map file to use when writing timeseries to the FewsPiService (type = string).
\# If omitted no id mapping takes place
IMPORT_IDMAP_ID=My_Import_IdMap

\# Export missing value. All internal NaN values will be mapped to this value (type = float).
\# If omitted the default value \-999 will be used.
MISSING_VALUE=-999

\# Option to skip the export of missing values when reading timeseries from the FewsPiService (type = true/false).
\# If omitted the default value 'true' is used.
OMIT_MISSING_VALUES=true

\# Default time zone.
\# If omitted the computer time zone is used.
TIME_ZONE=GMT

Example SOAP calls

See [^soap-example-calls.zip] for examples SOAP client calls.

  • No labels