Concept

A stateful service is a service that maintains a context between a web services client and server. It enables the service to keep trace of previous requests from that context, in order to manage different states in the web service server.

Genero Web Services supports two kinds of stateful services:

  • Based on the WS-Addressing 1.0 specification to define the XML format used to convey the context from client to the server

  • Based on an HTTP session cookie to convey the context from client to the server

The Genero Web Service engine uses a BDL variable defined at stateful service creation via createStatefulWebService() as service context. Use that variable to hold a service state in a database.

It is up to the BDL programmer to create, store and remove the service state in the database.

The SOAP engine is responsible for:

  • Deserializing the state variable when getting an new incoming request. The programmer can then read the state variable for any published BDL web service operation and restore the service state corresponding to that variable.

  • Serializing a new instance of the state variable in a web service response for all BDL web service operations set as session initiator via initiateSession(). The programmer must instantiate a new state by filling the state variable and storing it into a database for further use.