Note: This is the WFSRI 3.5 User Guide. If you are running Version 3.0 or earlier, please see the WFSRI 3.0 User Guide.
The Web Feature Service Reference Implementation (WFSRI) is a test platform for publishing GML-formatted data to and retrieving it from the 4-Dimensional Weather Data Cube. Specifically, it allows providers to insert weather-related data sets into a database on a Web Feature Server, and it allows users to query and request the data sets.
This User Guide details how to:
Before you can have feature types added to your WFSRI database, you must create a set of files for each feature type. Many of these files for known feature types have already been created for you and supplied with the Registration Client but they may need to be modified for your service so you must check and alter each file as required. If you are creating a feature type which does not yet exist in the supplied set, you can use the existing files as a guide when creating the new files.
The feature type configuration file is a properties file which tells the registration client the location of the other required files, as well as providing other information required to configure and self-test the feature type. For each feature type to be added to the database, there must be a a feature type configuration file in $CONFIG_DIR/feature-types, such as contours.properties, and it should have the following information:
The next four properties, if present in the file, are not used by the registration client and should be left blank:
The remaining set of files required for each feature type should be located in the appropriate subdirectories under $WFSRI_INSTALL/data. If the files do not exist for your required feature type, you must add them. If they exist but need to be modified for your particular feature type, you should modify the files supplied with the WFSRI installation.
The schema definition file for each feature type should be created and placed in $WFSRI_INSTALL/data/xsd, for example, $WFSRI_INSTALL/data/xsd/wxContour.xsd.
Each feature type requires a mapping file (i.e., a Feature Table Definition XML File) located in a subdirectory under $WFSRI_INSTALL/data/xml/mapping, for example, $WFSRI_INSTALL/data/xml/mapping/Contours/contours.xml. This file location is referenced in the feature type configuration file in $CONFIG_DIR/feature-types as the mapFile property (e.g. - mapFile=xml/mapping/Contours/contours.xml) and contains XML necessary to map the feature type fields in the XML schema to the feature table fields/columns in the WFS database.
If you would like details on preparing the Feature Table Definition XML, see the Specifying the Feature Table Definition XML entry on the WFSRI 3.5 User Guide Examples page.
Each feature type requires a registration file (i.e., a Feature Type Registration Properties File) located in a subdirectory under $WFSRI_INSTALL/data/xml/registration, for example, $WFSRI_INSTALL/data/xml/registration/Contours/contoursRegister.properties. This file location is referenced in the feature type configuration file in $CONFIG_DIR/feature-types as the featureTypeDetails property (e.g. - featureTypeDetails=xml/registration/Contours/contoursRegister.properties) and contains the following key value pairs denoting each element:
Contour
.xml/capability/Contours/Contours.xml
.xsd/wxContour.xsd
.urn:ogc:def:crs:ESPG::4326
.GABRIEL
.CONTOURS
.ID
.GEOMETRY
.GML32
../contourValue, ./geometry
.In order to perform self-test diagnostics for a given feature type, each feature type requires an insertion XML file (to perform transaction-inserts) and a retrieval XML file (to perform GetFeature requests). The insertion XML file should be located in a subdirectory under $WFSRI_INSTALL/data/xml/transaction-insert, for example, $WFSRI_INSTALL/data/transaction-insert/ContoursData/contours-1.xml. This file location is referenced in the feature type configuration file in $CONFIG_DIR/feature-types as the insertionXML property (e.g. - insertionXML=xml/transaction-insert/ContoursData/contours-1.xml) and contains XML necessary to perform a Transaction Insert request. The retrieval XML file should be located in a subdirectory under $WFSRI_INSTALL/data/xml/get-feature, for example, $WFSRI_INSTALL/data/get-feature/ContoursQueries/contours-1.xml. This file location is referenced in the feature type configuration file in $CONFIG_DIR/feature-types as the retrievalXML property (e.g. - retrievalXML=xml/get-feature/ContoursQueries/contours-1.xml) and contains XML necessary to perform a Get Feature request.
With the Feature Tables and their Types registered, you should schedule executions of the WFS Maintenance Scripts. These scripts manage the WFS database; initializing them will specify how long to store data before deleting it and how often to optimize the database partitions.
The scripts are run by executing an SQL scheduling script from the prompt. First, however, you must create this scheduling script and fill its values in to conform to the Feature Types you have registered, set how long they are stored in the database, and schedule how often the checks are run.
sched_maintenance.sql
. This file may be located anywhere you wish, so long as you can remember its location and reference it from within the prompt. Copy and paste the following code into this new script file:repeat_interval
to match how often you would like the cache flushed.<PRODUCT> |
The name of the Feature Type associated with this maintenance job. This is an arbitrary identifier, used to reference the job when enabling, disabling, running, or stopping it. For example, Contours . |
<FTNAME> |
The name of the Feature Table created for this Feature Type. For example, CONTOURS . |
<PROD> |
The name of the Producer associated with this Feature Table. For example, CIWS . |
<SPATIAL> |
The name of the given Feature Table's spatial column. For example, GEOMETRY . |
<RETENTION> |
The amount of time data for this Feature Type should be retained before being deleted, in days, hours, minutes, and seconds. For example, 15 00:00:00.0 would store data for 15 days, 0 hours, 0 minutes, and 0 seconds. |
sched_maintenance.sql
file once you have finished.The WFS Maintenance Scripts are run from the command line. You must be able to log into your WFS database as an administrator to execute them.
SQL>
prompt, execute your sched_maintenance.sql
file by typing an @
symbol, followed by the path to the file.
|
---|
The metadata returned in the Get Capabilities response can now be customized by the service provider. In the $CONFIG_DIR, use the serviceProvider.xml and operationsMetadata.xml files as inputs for customizing the ServiceProvider and OperationsMetadata sections, respectively, of the WFS_Capabilities document. Ensure the XML fragments validate as minimal validation is done on the part of the WFSRI.
The WFSRI now provides the ability to search for data in a parent, or upstream, WFS when the requested data is not found locally on the queried server. This functionality can be performed without the use of a registry/repository - when requested feature data is not found locally, a check is made to see if an upstream WFS has been configured and the request is then sent to that WFS. To enable this functionality, the $CONFIG_DIR/reroute.properties file must be configured with the information required to locate the upstream WFS. See the documentation within the $CONFIG_DIR/reroute.properties file to learn which properties to configure for this capability. If this property file exists, and is configured correctly, the WFS will automatically send the requests to the upstream WFS if the data is not stored locally. By default, the reroute.enabled flag is set to false to disable rerouting.
The WFSRI now provides the ability to use service profiles to set rules which limit actions on client requests. For example, it will allow a service to limit the quantity of data all clients can request in one Get Feature request which can be used to prevent users from monopolizing a given WFS installation. To enable such a limit, the service provider would configure a service profile XML file to limit all requests for a given producers data to a maximum of one hour of data per Get Feature request. The configuration file $CONFIG_DIR/profiles.xml is now provided which can be used to set up the service profile for a given WFS. This file can contain multiple profile rules and can be configured on a producer-by-producer basis. The provided $CONFIG_DIR/profiles.xml file gives an example of how to limit the client to constrain the range of time requests to one hour of data per request, for a given producer.
Profiles can be created for any field returned in a GetFeature or Subscribe request which is of type string, boolean, integer, double, or date/time and which can be queried as a property which is equal, not equal, greater than (or equal) or less than (or equal) to a given value.
To enable the use of configured profiles in the profiles.xml file, create your own profiles in the $CONFIG_DIR/profiles.xml file. By default, the profiles.xml file is provided with one sample profile which has been commented out.
WFS service providers can now use JConsole to observe various monitoring metrics which are provided in the WFSRI. The $CONFIG_DIR/monitoring.properties file provides properties which can be used to enable or disable the reporting of monitoring metrics and the interval at which monitoring reports are generated (daily, weekly, monthly, quarterly, yearly).
Metrics gathered and reported include:
The WFSRI now performs XML schema validation on incoming requests if the corresponding flag is set to true in the wfsri.properties file. Validation is enabled by default. To enable or disable validation, set the validation.enabled property in the $CONFIG_DIR/wfsri.properties to true or false respectively.
The NNEW team has released a generic SOAP client capable of executing all supported WFS operations. As outlined in the WFSRI 3.5 Installation Guide, the directory you download the SOAP client to should be referenced by the environment variable $SOAPCLIENT
.
To execute operations with the SOAP client, type the following command into the Linux terminal from the $SOAPCLIENT
directory, replacing the placeholders as directed in the table below:
<url> |
The SOAP URL on which the WFSRI is listening (e.g., http://<WFSRIserver>/soap/wfs ). This is the value of wfs.url , set in the wfsri.properties file during configuration of the WFSRI. |
<file> |
The XML file containing the operation's request. |
<user> |
The appropriate Producer or consumer username (consumers have read-only access to a WFSRI, Producers have both read and write access). This would have been set in the CamelContext.xml file when configuring the WFSRI |
<pass> |
The appropriate Producer or consumer password (consumers have read-only access to a WFSRI, Producers have both read and write access). Like the username, this would have been set in the |
See the sections below for more information on the appropriate XML files to pass for each of the supported operations.
Once you have created a new Feature Table and registered its Feature Type, you can use the Transaction-Insert operation to insert Features of that type. See the Example Transaction-Insert Request XML File on the WFSRI 3.5 User Guide Examples page if you would like to view examples.
The GetCapabilities operation can be used to determine what Feature Types are currently registered with a Web Feature Server, allowing you to then insert Features of those Feature Types into their respective Feature Tables. It can also be used to query other information from a Web Feature Server – information about its service provider, supported operations, and filtering capabilities for GetFeature queries – but retrieving a list of Feature Types is most common.
When querying a Web Feature Server for a list of its available Feature Types (or any other information retrievable via the GetCapabilities operation), you can use the SOAP client to pass an XML request file to the server. This example XML file is a GetCapabilities request for a Web Feature Server's service identification and provider, metadata, and list of Feature Types:
See the Example GetCapabilities Response File #1 on the WFSRI 3.5 User Guide Examples page for an example of the code that would be returned by the above request.
Whereas the above example calls for several pieces of information, the example below is only requesting a Web Feature Server's list of Feature Types:
See the Example GetCapabilities Response File #2 for an example of the code that would be returned by the above request.
Note that the return of Feature Type data is intrinsic in the request; you do not need to explicitly request Feature Type data to get it from the Web Feature Server.
Observe the following rules when creating a GetCapabilities file requesting data from a Web Feature Server:
service
attribute of the GetCapabilities
element must be set to "WFS".Section
value indicates whether that Section's given data is being requested. Only include Section
elements for Sections you wish returned.FeatureTypeList
Section responds with the abbreviated version of the Feature Type description, as set when the Feature Type was first registered. The actual returned value would have been provided to the Web Feature Server as a Feature Type Description XML File (the featuretypeDescFile
file), entered as part of the Feature Type registration in the Defining Feature Tables / Types section above.It is also possible to perform a GetCapabilities request via a URL, such as through a browser's address bar or a Unix wget
command. This URL should be structured as follows, where <SERVER>
is the address of the WFS server you are querying (usually in the form, server:8080/wfs
) and each <kvp#>
is a key-value pair.
The service=wfs
key-value pair is required and case-sensitive; all subsequent key-value pairs are optional. The table below lists each valid key-value pairing and its purpose in the GetCapabilities request:
updatesequence=<#> |
The sequence number you are querying. May only appear in the URL once. For example, 0 . |
acceptformats=<format> |
The format requested for returns from the WFS. This key-value pair may be passed in for every acceptable format requested by the client. At this time, however, the WFSRI only returns data in application/xml format. |
acceptversions=<version> |
The requested WFS version. This key-value pair may be passed in for every acceptable version requested by the client. For example, 2.0.0 . |
section=<sectionname> |
The name of a requested Section to have the WFS return. This key-value pair may be passed in for every acceptable Section requested by the client. For example, OperationsMetadata or ServiceIdentification . |
The WFSRI now suports the use of POX, or Plain Old XML, to make requests rather than making requests via SOAP-wrapped messages. Although the WFSRI will now support POX, it is up to the user of the service to create a POX client, or interface, to make these calls. The Get Capabilities, Describe Feature Types, Get Features, Subscribe, Unsubscribe, Pause, Resume and Renew requests are all supported with a POX interface, and would look identical to the SOAP requests, minus the SOAP envelope which encapsulates the XML.
A POX interface is useful when no security requirements are mandated for the WFS and the user, or client, wishes to make straight XML calls to the service.
This example XML file is a GetCapabilities request for a Web Feature Server's service identification and provider, metadata, and list of Feature Types. As you can see, it is identical to the SOAP request. The SOAP client places a SOAP header (or envelope) around the POX request for users before sending the request on to the WFSRI:
Once you have used the GetCapabilities operation to determine what Feature Types are currently being stored in a Web Feature Server, you can then turn to the DescribeFeatureType operation to get their individual details. Note, however, that at the moment the DescribeFeatureType operation only supports requests for one Feature Type's information at a time.
The following is an example DescribeFeatureType Request XML file:
When passing a DescribeFeatureType XML file to a Web Feature Server, ensure the namespace prefix (in the case of the above example, "tfdm") is included in the TypeName
element's value.
If the XML is properly formatted, the Web Feature Server will respond with the appropriate Feature Type's schema.
Once you have a Web Service containing inserted feature data, you can use the GetFeature operation to request the feature data. See the Example GetFeature Request XML File on the WFSRI 3.5 User Guide Examples page if you would like to view examples.
In addition to using the GetFeature Request to perform one-time requests of feature data, the WFSRI supports client subscriptions. Using the generic SOAP client, consumers can pass special GetFeature subscription requests to the WFSRI, subscribing themselves to updates of Feature data as changes are published to the Web Feature Server.
To subscribe to GetFeature updates, a consumer can use the SOAP client to pass a Subscribe request XML file to the WFSRI (see the Example Subscribe Request File on the WFSRI 3.5 User Guide Examples page for an example GetFeature subscription). Each request is comprised of five elements:
ConsumerReference |
The ConsumerReference element and its child elements are required by the WFS standard, but are ignored by the WFSRI. |
Leave this element blank. |
protocol |
The protocol element defines the protocol used to communicate with the Web Feature Server. At this time, only jms-tcp is supported. |
Set to jms-tcp . |
topic |
The topic elements serves as the subscription's identifier so that it can be referenced by other subscription requests. |
You may give the subscription a topic name of your choice, in the format dynamicTopics/<name> . |
InitialTerminationTime |
The InitialTerminationTime element defines a duration for a given subscription. |
See the InitialTerminationTime Element below for formatting information. If the element is absent, a subscription is set as indefinite. |
GetFeature |
A complete GetFeature request element is required within the subscription request. |
This element should be formatted identically to a standalone GetFeature request XML file. See the Example GetFeature Requests XML File on the WFSRI 3.5 User Guide Examples page. |
The legal methods in which subscription requests can be made are as follows:
If neither a topic name nor a GetFeature request are provided, the WFSRI will return an error.
The InitialTerminationTime
element in a Subscription request defines how long a subscription will last by specifying when it terminates. It may be defined using either the duration
data type (a set time interval from the start of the subscription) or the dateTime
data type (a specific moment that, when reached, signals a subscription's end). At the given termination time, the WFSRI removes the subscription as though its subscriber had initiated an Unsubscribe request.
From http://www.w3schools.com/Schema/schema_dtypes_date.asp
The
dateTime
data type is used to specify a date and a time.The
dateTime
is specified in the following form "YYYY-MM-DDThh:mm:ss
" where:
YYYY
indicates the yearMM
indicates the monthDD
indicates the dayT
indicates the start of the required time sectionhh
indicates the hourmm
indicates the minutess
indicates the secondTo specify a time zone, you can either enter a dateTime in UTC time by adding a "Z" behind the time or you can specify an offset from the UTC time by adding a positive or negative time behind the time.
As such, the dateTime
entry 2010-07-23T14:56:00Z
means "July 23, 2010, at 2:56:00 P.M. Zulu," while the entry 2011-05-01T00:00:00-4
means "May 1, 2011, at midnight Eastern Standard Time."
The
duration
data type is used to specify a time interval.The time interval is specified in the following form "PnYnMnDTnHnMnS" where:
- P indicates the period (required)
- nY indicates the number of years
- nM indicates the number of months
- nD indicates the number of days
- T indicates the start of a time section (required if you are going to specify hours, minutes, or seconds)
- nH indicates the number of hours
- nM indicates the number of minutes
- nS indicates the number of seconds
As such, the duration
entry P000305T141530
means "three months, five days, 14 hours, 15 minutes, and 30 seconds."
If the IntialTerminationTime
value is malformed, the WFSRI will return a WSN ResourceUnknownFault.
When you subscribe to GetFeature updates from a WFSRI, you will receive a response from the Web Feature Server in the form of an XML file, much like the Example Subscribe Response File on the WFSRI 3.5 User Guide Examples page. This file contains a SubscriptionReference
element, which holds two pieces of information:
urn:uuid:<identifier>
, where <identifier>
is a Version 4 UUID in the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx (where the x
values are random hexadecimal digits and y
is '8
', '9
', 'a
', or 'b
').The WFSRI's transport URI is formatted as follows:
<hostname> |
The DNS name or IP address of the ActiveMQ server, as set in the wfsri.properties file during initial WFSRI installation and configuration. |
<port> |
The port number of the ActiveMQ server on which ActiveMQ is listening and publishing. Default is 61616 . |
<desttype> |
The transport mechanism's destination type. In the current implementation, the WFSRI only supports either queue (for point-to-point, single-producer to single-consumer connections) or topic (for multitasking scenarios where there are multiple producers or consumers in the relationship). topic is the default and most likely value you will see. |
<destname> |
The label identifying the destination, in the format dynamicTopics/<name> . If you gave the subscription a name in the request, it will be echoed here; otherwise, the WFSRI will return a generated name. |
Note that while ActiveMQ supports a variety of transport types (jms
, xmpp
, db
, and file
) and protocols (stomp
, tcp
, udp
, xmpp
, and http
), Version 3.5 of the WFSRI only supports the jms
transport type, and the tcp
or http
protocols.
In the event that you would like to temporarily halt subscription updates, you may elect to pause a subscription with a PauseSubscription request, stopping subscribed updates until a ResumeSubscription request is sent. It should be noted that pausing a subscription does not affect its termination time in any way. Thus, if a paused subscription hits its preset termination time, it expires, and attempts to resume it with a ResumeSubscription request will result in a ResourceUnknownFault.
Both the PauseSubscription and ResumeSubscription requests respond with ResourceUnknownFault errors if they are missing UUIDs or are made with malformed UUIDs, or are directed at an unknown subscription. Otherwise, they return a PauseSubscriptionResponse and ResumeSubscriptionResponse, respectively – although both are empty in the current WFSRI release. Should failures occur during a PauseSubscription or ResumeSubscription, the WFSRI will return a PauseFailedFault or ResumeFailedFault, respectively. Any other responses from the WFSRI aside from those mentioned above represent errors in the original request.
For examples of PauseSubscription and ResumeSubscription request and response files, see the WFSRI 3.5 User Guide Examples#Example PauseSubscription Request and Response Files and WFSRI 3.5 User Guide Examples#Example ResumeSubscription Request and Response Files, respectively, on the WFSRI 3.5 User Guide Examples.
To renew a subscription that is about to expire, or to give an expiration time to a subscription that did not originally have one, send the WFSRI a Renew request with a new TerminationTime element to replace the old TerminationTime (see the The InitialTerminationTime Element above for details). Note that if the new TerminationTime is expressed as a duration
, it will ignore the remaining time in the original subscription's duration, overwriting it and starting the renewed subscription from the current clock time. Thus, if a subscription with one hour left in its original duration was renewed for another 12 hours, it would terminate after those 12 hours elapsed, not 13.
If a Renew request is made after a subscription expires, it will return a ResourceUnknownFault, as the subscription would no longer exist. Likewise, the Renew request will respond with a ResourceUnknownFault if it contains a malformed or missing UUID. Should an invalid time be passed into a Renew request, the WFSRI will respond with an UnacceptableTerminationTimeFault.
In a departure from the WSN 1.3 spec, the WFSRI will return a BaseFault in the event a failure occurs during its attempt to renew a subscription.
For examples of RenewSubscription request and response files, see the WFSRI 3.5 User Guide Examples#Example RenewSubscription Request and Response Files on the WFSRI 3.5 User Guide Examples page.
If you wish to unsubscribe from a subscription, regardless of whether or not it contains a preset termination time, you can use the Unsubscribe request, specifying the UUID of the subscription and instructing the WFSRI to cancel it.
The WFSRI will respond to an Unsubscribe request with a ResourceUnknownFault if the request has a missing or malformed UUID, or points to an unknown subscription (which includes subscriptions that have already expired). Otherwise, it returns an empty UnsubscribeResponse, which signifies success. If anything is returned other than an empty UnsubscribeResponse, it is an error.
For examples of Unsubscribe request and response files, see the WFSRI 3.5 User Guide Examples#Example Unsubscribe Request and Response Files on the WFSRI 3.5 User Guide Examples page.
Version 3.5 of the WFSRI comes with the WFSRI Repeater: a component that retrieves data from an origin Web Feature Server and replicates it to a distribution server. The Repeater provides clients with the ability to retrieve the same data from the distribution server as exists on the origin server, in cases where they may not have access to the latter system.
Each instance of the WFSRI Repeater can only subscribe to updates of a single Feature Type from an Origin Server. Thus, you must run concurrent instances of the Repeater if you want to subscribe to updates of multiple Feature Types and pass them on to a Distribution Server.
To run an instance of the Repeater, you must make a copy of the $WFSRI_REPEATER/wfs-repeater.properties
file tailored to the Feature Type you wish to repeat, and have on hand that Feature Type's Subscription Request XML file, before running the Repeater's .jar
executable.
$WFSRI_REPEATER/wfs-repeater.properties
file, tailoring its key value pairs to fit the data type you plan to subscribe to:originEndpoint
– This is the endpoint of the origin WFSRI instance. It must match the wfs.url
element in the $CONFIG_DIR/wfsri.properties
file on the origin Web Feature Server. For example, http://origin-server:8084/wfsri-3.5/wfs
.originUsername
– This is the username of a user in the origin WFSRI instance. It must match an entry in the userMap
element of the $WFSRI_HOME/WEB-INF/CamelContext.xml
file on the origin Web Feature Server. For example, ORIGINWFSUSER
.originPassword
– This is the password of a user in the origin WFSRI instance. Like the originUsername
, it must match an entry in the userMap
element of the $WFSRI_HOME/WEB-INF/CamelContext.xml
file on the origin Web Feature Server. For example, TEST
.distributionEndpoint
– This is the endpoint of the distribution WFSRI instance. It must match the wfs.url
element in the $CONFIG_DIR/wfsri.properties
file on the distribution Web Feature Server. For example, http://distribution-server:8084/wfsri-3.5/wfs
.distributionUsername
– This is the username of a producer in the distribution WFSRI instance. It must match an entry in the userMap
element of the $WFSRI_HOME/WEB-INF/CamelContext.xml
file on the distribution Web Feature Server. For example, DISTRIBWFSUSER
.distributionPassword
– This is the password of a producer in the distribution WFSRI instance. Like the distributionUsername
, it must match an entry in the userMap
element of the $WFSRI_HOME/WEB-INF/CamelContext.xml
file on the distribution Web Feature Server. For example, TEST
.subscribeFilename
- This is the filename of the Subscribe request XML file, relative to the $WFS_REPEATER/conf directory, used to create a subscription on the origin WFSRI instance. Using the $WFS_REPEATER/lightningFlashSub.xml
file as an example, modify the value of the typeNames
attribute in the GetFeature/Query
element to your chosen Feature Type, using the form <namespace prefix>:<local name>
. Ensure the namespace prefix is bound by an xmlns
attribute in the Subscribe
element. For example, WFSRI 3.5 User Guide Examples#Example Subscribe Request File.wfsri-repeater-3.5.jar
file, replacing the <file>
placeholder with the name of your customized copy of the wfs-repeater.properties
file, also relative to the $WFS_REPEATER/conf directory:wfs-repeater.properties
file was called custom.properties
, and was located in the $WFS_REPEATER/conf directory, the command would be:User Guide | |