Overview

The WiskiService import function (<importType>WiskiService</importType>) imports data from REST services that return XML content.

The REST Service URLs look as follows http://servername:portnumber/context/services/HydroData/getProductData? followed by some parameters.

The wiski service supports some different "dataStore" formats that can be configured as a property in the import. The following formats are supported by the WiskiService import function:

  • dataSource=ORG: Original data
  • dataSource=PRO: Product data
  • dataSource=TideInsert5: Statistical data

Configuring the Import

To make the importer known to FEWS, the import module has to be declared in the moduleInstanceDescriptors.xml in the RegionConfigFiles directory of the FEWS configuration:

<?xml version="1.0" encoding="UTF-8"?>
<moduleInstanceDescriptors xmlns="http://www.wldelft.nl/fews"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://www.wldelft.nl/fews
		http://fews.wldelft.nl/schemas/version1.0/moduleInstanceDescriptors.xsd" version="1.0">
...
	<moduleInstanceDescriptor id="ImportWiskiService">
		<description>Imports WiskiService</description>
		<moduleId>TimeSeriesImportRun</moduleId>
	</moduleInstanceDescriptor>

...
</moduleInstanceDescriptors>


An example of the WiskiService import configuration is given here. The importType is named WiskiService which should be configured in the general section of the import. The URL to the rest service should be configured here as well. The actual data to be retrieved can be tuned by setting the relativeViewPeriod and the timeSeries to specify the locations and parameters. N.B.: the used parameters and locations have to be mapped with an idMap (IdWiskiService in this example).
TimeZone is assumed to be configured in the general section, otherwise GMT is assumed.

<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesImportRun xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/timeSeriesImportRun.xsd">
	<import>
		<general>
			<importType>WiskiService</importType>
			<serverUrl>http://dummy_hostname:8090/dummy_servicename/</serverUrl>
			<user>dummy_username</user>
			<password>dummy_password</password>
			<relativeViewPeriod unit="week" start="-1" end="0" startOverrulable="true" endOverrulable="true"/>
			<idMapId>IdWiskiService</idMapId>
			<importTimeZone>
				<timeZoneName>GMT-5</timeZoneName>
			</importTimeZone>
		</general>
		<properties>
			<string key="dataSource" value="ORG"/> 
			<!-- Supported dataSource values are:
					ORG = Original
					PRO = Product
					....
			-->
		</properties>
		<timeSeriesSet>
			<moduleInstanceId>ImportWiskiService</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>H.obs</parameterId>
			<locationId>Amsterdam</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
		</timeSeriesSet>
		<timeSeriesSet>
			<moduleInstanceId>ImportWiskiService</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>H.obs</parameterId>
			<locationId>Delft</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
		</timeSeriesSet>
		<timeSeriesSet>
			<moduleInstanceId>ImportWiskiService</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>Q.obs</parameterId>
			<locationId>Amsterdam</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
		</timeSeriesSet>
		<timeSeriesSet>
			<moduleInstanceId>ImportWiskiService</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>Q.obs</parameterId>
			<locationId>Delft</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
		</timeSeriesSet>		
	</import>
</timeSeriesImportRun>

The previous timeseries will be mapped using IdWiskiService id mapping:

	<parameter external="WindSpeed" internal="H.obs" />
	<parameter external="WindDirection" internal="Q.obs" />
	
	<location external="CFA365" internal="Amsterdam" />
	<location external="CFA600" internal="Delft" /> 

The previous configuration will result in the following 4 REST urls being used:

 
http://server:port/context/services/HydroData/getProductData?stcds=CFA365&param=WindSpeed&funct=all&begDate=20140930170000&endDate=20141031180000
http://server:port/context/services/HydroData/getProductData?stcds=CFA600&param=WindSpeed&funct=all&begDate=20140930170000&endDate=20141031180000
http://server:port/context/services/HydroData/getProductData?stcds=CFA365&param=WindDirection&funct=all&begDate=20140930170000&endDate=20141031180000
http://server:port/context/services/HydroData/getProductData?stcds=CFA600&param=WindDirection&funct=all&begDate=20140930170000&endDate=20141031180000

Example XML response from WiskiService service


...This XML file does not appear to have any style information associated with it. The document tree is shown below.
<ns:getProductDataResponse xmlns:ns="http://webservice.dep.kisters.de" xmlns:ax25="http://bean.dep.kisters.de/xsd">
<ns:return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax25:DataBean">
<ax25:avg>0.0</ax25:avg>
<ax25:data>20140930170000,351.0</ax25:data>
<ax25:data>20140930170500,348.0</ax25:data>
<ax25:data>20140930171000,351.0</ax25:data>...<ax25:data>20141031174000,109.0</ax25:data>
<ax25:data>20141031174500,125.0</ax25:data>
<ax25:data>20141031175000,110.0</ax25:data>
<ax25:data>20141031175500,97.0</ax25:data>
<ax25:data>20141031180000,107.0</ax25:data>
<ax25:max>0.0</ax25:max>
<ax25:maxTime xsi:nil="true"/>
<ax25:min>0.0</ax25:min>
<ax25:minTime xsi:nil="true"/>
<ax25:para>WindDirection</ax25:para>
<ax25:para_cname>风向</ax25:para_cname>
<ax25:src>WISKI6</ax25:src>
<ax25:stcd>CFA600</ax25:stcd>
<ax25:sum>0.0</ax25:sum>
</ns:return>
</ns:getProductDataResponse>



  • No labels