-
Notifications
You must be signed in to change notification settings - Fork 2
Configuration
Configuring the Data Export service is done through standard .NET configuration files.
Beginning with version 1.1 of the DataExport, adding and/or modifying data exports can be managed
entirely through custom configuration settings in the _configSource\DataExport.config file, which is referenced from the application's Web.config.
Each export is defined by a single <exporter name=""/> node, which includes one - and only one - of each of the following configuration nodes:
- Data Input - defines how the raw data is obtained.
- Formatter - defines how the data is formatted.
- Deliverer - defines how the formatted data is transmitted to the vendor/3rd party.
<dataExport>
<exporters>
<exporter name="">
<!-- Data input: One of the following -->
<sqlInput connection="key|connection string"
provider="System.Data.SqlClient"
command="SQL statement"
timeout="60" />
<!-- Formatters: One of the following -->
<csvFormat fieldSeparator=","
trimFromFieldStart=""
trimFromFieldEnd=""
includeHeader="true|false" />
<xslFormat template=""
templateFile="" />
<!-- Delivery: One of the following -->
<sftpDelivery host="hostname"
username="login"
password="password"
keyFile="path/to/file"
destination="/path/to/remote/upload/folder"
saveCopy="true|false" />
</exporter>
</exporters>
</dataExport><exporter
-
name - (REQUIRED, UNIQUE) The exporter name maps directly to the URL which invokes that exporter. For example; when the URL
http://YOUR_SERVER_DOMAIN/dataexport/Api/Export/myexportis visited, the Data Export service looks for a configured exporter with the name myexport. ><A valid data input node>
<A valid format node>
<A valid delivery node>
</exporter>
Each exporter must have one - and only one - data input node. This configuration node defines from where and how the data to be exported is retrieved. At the time of this writing, the Data Export tool only includes support for the sqlInput node, but the application's architecture supports adding additional inputs. (NOTE: sqlInput has only been tested with MS SQL Server 2008.)
<sqlInput
- connection - (DEFAULT: "Default") Either an actual connection string, or the name of a connectionString stored elsewhere in the Web.config.
- provider - (DEFAULT: "System.Data.SqlClient") The database provider type.
- command - (REQUIRED) The SQL query to execute. This query must return a recordset.
- timeout - (DEFAULT: 30) The number of seconds to wait for a response to the query from the database server. If the application does not receive a response within this time limit, a timeout error occurs.
/>
Each exporter must have one - and only one - formatter node. This configuration node defines how the raw data received from the data input should be formatted before being sent (e.g. delivered) to the party that requested it. At the time of this writing, the Data Export service supports two formatters: csvFormat and xslFormat:
<csvFormat - Provides simple, delimited formatting. Each record represented on one line.
- fieldSeparator - (DEFAULT: ",") Provides the character (or characters) to separate fields with. If omitted, each field will be separated by a comma.
- trimFromFieldStart - If present, the formatter will remove each of the characters specified from the beginning of every field. (e.g. ",;" will trim both commas and semi-colons)
- trimFromFieldEnd - If present, the formatter will remove each of the characters specified from the end of every field. (e.g. ",;" will trim both commas and semi-colons)
- includeHeader - (DEFAULT: false) Specifies whether the first line of the formatted data should identify the column names.
/>
<xslFormat
- template - NOT YET SUPPORTED.
- templateFile - Name of the XSL Transform file to use for formatting. This file must be present in the ~/Templates folder of the Data Export service.
/>
Each exporter must have one - and only one - delivery node. This configuration node specifies how to get the formatted data to the organization that requested it. At the time of this writing, the Data Export service supports delivery via SFTP and (untested) file copy.
<sftpDelivery
- host - (REQUIRED) The hostname of the destination SFTP server which the data will be uploaded to.
- username - (REQUIRED) Login for the SFTP host.
- password - (OPTIONAL if ''keyFile'' provided) The password for the ''username'' provided. If omitted, a ''keyFile'' '''must''' be provided.
- keyFile - (OPTIONAL if ''password'' provided) The path and filename where a valid SSH key file is stored for the ''username'' specified. This key must have a blank pass phrase.
- destination - (REQUIRED) Filename and location of the file to upload. (This is the location on the SFTP host.)
- saveCopy - (DEFAULT: false) If true, a local copy of the file being uploaded is saved to the application folder. NOTE: Security settings typically prohibit writing to the application directory of a web server.
-
writeMode - One of the following:
- overwrite - Overwrite/replace the file if it already exists at the destination.
- exception - (DEFAULT) Throw an Exception if the file already exists at the destination.
- ignore - Do nothing if the file already exists at the destination. Do not upload or replace the file.
/>
In addition to the exporter settings above, the Data Export service also recognizes the following application settings:
<applicationSettings>
<DataExport.Web.Properties.Settings>
<setting name="OverrideCurrentDate" serializeAs="String">
<value></value>
</setting>
<setting name="AllowFileDownload" serializeAs="String">
<value>False</value>
</setting>
</DataExport.Web.Properties.Settings>
</applicationSettings>- OverrideCurrentDate - (not currently being used)
- AllowFileDownload - When set to True, calls to the web service will respond by downloading the generated file. Otherwise, the browser displays a simple success/failure message while the data is transmitted to the specified 3rd-party vendor in the background.
WARNING: Only set this value to True during testing. Leaving it enabled could expose sensitive data to anyone calling this service.
- During testing, you may want to set AllowFileDownload to True in order to download the generated file for evaluation. Be sure to set it back to False before deploying to production.