Step 1: Declare any 4GL simple variable to be used as state variable

For example:
DEFINE ServiceState STRING # Unique ID to identify the service state in the database

For instance, you can use a unique ID of a database table to manage the web services sessions.