Work With External Data Sources
This task describes how to work with an external data source to import or export data.
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.
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.
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.
- Click a column in the displayed external data source table to bind that column.
- Repeat steps a and b for all columns you need to bind.
- Click OK. The data is imported.
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.
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.
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.|
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.
To change the location of the external data file, right-click the rule and select External Data Properties.
To disconnect a rule from an external data source and remove bindings, right-click the rule and select Disconnect External Data.