Share this page

# Simulate a Stateful Service

This task describes how to configure a virtual service to simulate stateful behavior.

In this topic:

## Virtualize stateful behavior

1. Prerequisite:

   Service Virtualization must have information on the message structure that the client uses. The structure of request/response messages is stored in the service description. You provide this information by doing one of the following:

   - Placing the virtual service in Learning mode to record real service behavior. For example, for a REST service.
   - Importing a service description document, such as when creating a SOAP service using an imported .wsdl service description document.
   - Importing messages into the virtual service's data model.

2. Define session identifiers:

   1. In the Service Description Editor, under Session IDs Definition, click Edit.

   2. In the wizard pages that open, specify values for session identifiers, and click Finish.

      Client-initiated sessions: For a service in which sessions are determined based on a client request, you can select an element of the request data to use as a session identifier. For example, a user ID.

      Server-initiated sessions: For a service in which sessions are determined based on a server response, you can select an element of the response data to use as a session identifier. For example, a client may send a login request, and the server returns a session ID that will identify the client session.

      For user interface details, see Session ID Definition Wizard.

3. Learn data again:

   Service Virtualization uses the session IDs to create different tracks based on the learned data, and uses the tracks to create different sessions during simulation.

Back to top

## Edit tracks

View and modify tracks using the Stateful Layout view of the Data Model Editor. For user interface details, see Stateful Layout View.

On the Data Model Editor toolbar, click Stateful Layout to display the track pane.

- Filter tracks. Select an option under Current Rule Tracks to display all tracks or tracks for current rule only.

- Edit a track.

  - Click inside a track name to edit.

  - Drag and drop items within a track to reorder.

- Delete a track. Delete the track only, or also delete the rows that include track positions of the selected track.

Back to top

## Reorder tracks

By default, tracks are ordered based on the track position's timestamp. For example, the first track created would be used first during simulation, the second track used next, and so on.

You can manually reorder that the tracks to redefine the sequence in which they are used during simulation.

At the bottom of the track pane, select a track you want to move and click the up/down arrows.

Back to top

## Create stateful behavior manually

1. In the Data Model Editor, create a blank rule and add data rows.
2. Create a new track. On the toolbar, click Stateful Layout to display the track pane.
3. Drag and drop rows from the data rule into the Stateful Layout track pane, in the order that you want.

For user interface details, see Data Model Editor and Stateful Layout View.

Back to top

See also:

- Stateful simulation
- Shopping cart session sample projects here: Welcome page.

https://admhelp.microfocus.com Service Virtualization 8942
Tips to improve your search results... Service Virtualization Help Center SV Help 5.4-5.4.1 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: