Work With External Data Sources

This task describes how to work with an external data source to import or export data.

Add an external data file

You can associate a data rule with an external data file in order to import or export data.

In the Data Model Editor, select New Rule > Data Driven Rule. Select one of the following options:

Create new data file. The Service Virtualization Designer creates a new Excel file, structured according to the schema (message structure) associated with the virtual service. Rule columns are automatically bound to the worksheet columns.

Use existing data file. You must then manually bind rule columns to worksheet columns. After binding, the external data is imported to the Data Model.

For details, see New Data Driven Rule Dialog Box.

Result: A "preview" of your external data file displays within the rule.

Note that the worksheets in the external file are displayed as tabs at the bottom of the data table.

Back to top

Bind the data

If you selected an existing data file, you must bind the data. You create mappings between the data columns in the external file, and the columns/headers in your data rule.

  1. In a column header, click bind data. If it is not visible, click View Options > Data Binding.

    Headers must be expanded down to the lowest level in order to bind.

  2. Click a column in the displayed external data source table to bind that column.
  3. Repeat steps a and b for all columns you need to bind.
  4. Click OK. The data is imported.

Back to top

Bind array data

When the message structure contains an array that needs to be data-driven, you need to work with a properly structured Excel file. The file must contain database-like relationships, using primary and foreign keys, which allow the mapping of one row to many.

When binding an array item, the Edit Sheet Relations dialog box opens automatically, enabling you to define the relationships between worksheets that are required for array binding. . For user interface details, see Edit Sheet Relations Dialog Box.

Alternatively, right-click the rule or column header and select External Data Properties. See the Sheet Relations area.

Back to top

Bind other data

You can configure binding for working with different data formats (REST protocol), different response types (SOAP protocol), or a message structure containing different types.

When you start to bind to an Excel worksheet column where the response can contain these types of data, the relevant dialog box opens automatically (The Data Format, Response Type, or Choice Data Binding dialog boxes). For user interface details, see Data Format/Response Type/Choice Binding Dialog Box.

Back to top

Configure import/export settings

You can configure rules to import or export data, or configure settings for rules already associated with an external data file.

Learned Data rule To export learned data, right-click the Learned Data rule and select Export Data.
Blank/custom rule To import data from or export data to an external data file, right-click the rule and select Import Data or Export Data.
Data driven rule For a rule already associated with an external file, you can change settings. Right-click the rule and select External Data Properties.

Back to top

Refresh the data

If you have selected the Data Synchronization option for your rule, the data is automatically re-imported or exported.

Note: For synchronizing data with a virtual service deployed on a Service Virtualization Server, make sure that the external data file is stored in a network location accessible to the Server.

To manually refresh data, right-click the rule and select Refresh Data. The data is imported or exported, depending on how the rule is configured.

Back to top

Change the path of the data source

To change the location of the external data file, right-click the rule and select External Data Properties.

Back to top

Disconnect external data

To disconnect a rule from an external data source and remove bindings, right-click the rule and select Disconnect External Data.

Back to top

See also: