Modify Virtual Service Behavior
This task describes how you can edit a data model, and customize it to meet your needs.
Note: To learn more about data models, see Data Modeling.
You can add data to your data model in the following ways:
- Learn Data. Put the virtual service into Learning mode to record real service behavior. When you are finished recording, the learned data is added to the data model. For user interface details, see Virtual Service Editor.
Import Messages. Import existing messages from a file, or copy/paste message formats into the data model. For user interface details, see Import Request/Response Message Dialog Box.
- Enter data manually.
You can specify which columns are displayed in the data table of a rule. In the Data Model Editor, select Columns > Change Columns, or right-click a column header and select Change Columns. For user interface details, see Change Columns Dialog Box.
If you need to manipulate some aspect of the simulated behavior, create a new rule.
You can create your own customized rules to modify the responses used during simulation. One typical use case is when you want to use learned data for simulation, but want to modify some part of the response.
Create one of the following:
- Blank rule. Create a new, empty rule. In the Data Model Editor, click New Rule > Blank Rule.
Data driven rule. Create a new rule using an external file as a data source. See the next step on adding external data sources.
For details on configuring the rules, see Define Rule Functions.
You can add additional data from external data sources to a data model for testing purposes. The supported format for this data is Microsoft Excel documents (.xls, .xlsx).
In the Data Model Editor, click New Rule > Data Driven Rule. Fill in the details. For user interface details, see New Data Driven Rule Dialog Box.
For more details on working with external data sources, see Work With External Data Sources.
You can configure a virtual service to call external services.
Note: Service call activity is supported for:
- SOAP services over HTTP or JMS
- XML services over HTTP, JMS, WebSphere MQ, or Filesystem
- REST services
- Binary over JMS
- In the Data Model Editor, select the operation from which you want to call the external service.
Click Activity > Import Activities.
For more details, see Call External Services.
If you have enabled message logging for your virtual service, you can import logged messages to the Data Model. In addition to learned data, this enables you to access messages that were recorded by Service Virtualization during Standby or Simulation modes.
For example, if you are simulating a REST service and receive an incorrect response, you can import the problematic message to the Data Model and update the response as needed.
For details on logging messages, see Message Logging.
You can view in real time how changes in the data model are affecting your simulation. In the Data Model Editor, select a row, and then select View Options > Simulation Preview.
The Simulation Preview pane displays a simulation of a message whose request matches the currently selected message in the Data Model Editor table. The message is passed to the simulation engine and the result is displayed in the response section.
For user interface details, see Simulation Preview Pane.
To apply changes, you must restart your simulation. In the Data Model Editor, click Restart Simulation.
For more actions you can perform in the Data Model Editor, see Data Model Editor Context Menus.
For additional tips on working in the Data Model Editor, see FAQs: Data Model Editor.