com.WebService.CreateStatefulWebService

Creates a new object to implement a stateful Web Service.

Syntax

com.WebService.CreateStatefulWebService(
   name STRING,
   ns STRING ,
   state RECORD  )
  RETURNS com.WebService
  1. name defines the Web Service identifier.
  2. ns defines the namespace for the Web Service.
  3. state defines the state between the client and server.

Usage

The com.WebService.CreateStatefulWebService() class method creates a new com.WebService object implementing a Web Service that is stateful.

The name and ns parameters must uniquely identify the Web Service across the entire application, when multiple Web Service programs run on the same server. In theory, the value of ns+name must be unique on the internet.

The state variable is used to identify the state between the client and the server:

  • For a WS-Addressing stateful service, the state variable must be a RECORD with the following structure, with the W3CEndpointReference variable attribute:
    RECORD ATTRIBUTES(W3CEndpointReference)
      address STRING, -- The location of the Web Service (for ex: URL)
      ref RECORD
        ... (other members defining the state)
      END RECORD
    END RECORD
  • For a stateful service based on HTTP cookies, the state variable must be a simple variable defined with a basic data type.

It is up to the programmer to manage the state variable and to restore the service state from a database.

When creating a stateful Web Service, all published Web Operations require a session in the client request excepted those defined as 'initiateSession'.

In case of error, the method throws an exception and sets the STATUS variable. Depending on the error, a human-readable description of the problem is available in the SQLCA.SQLERRM register. See Error handling in GWS calls (STATUS).