Step 3: Instantiate a new session by calling the web service operation set as session initiator

Call the 4GL function generated from the WSDL that was defined as session initiator on the server. This function returns a new HTTP Cookie saved into the Binding.Cookie member of the global service variable of type tGlobalEndpointType. If your application handles several instances, you will have to copy and store that cookie in your application to identify a service instance for further requests.

For example:
DISPLAY "Creating a new instance ..."
LET wsstatus = GetInstance_g() # call the service session 
                               # initiator web function
IF wsstatus == 0 THEN
  # copy the service returned HTTP cookie
  LET instance1 = 
   StatefulCookieService_StatefulCookieServicePortTypeEndpoint.Binding.Cookie 
ELSE
  ... handle soap errors
END IF

When creating a new instance, ensure that the Binding.Cookie member of the generated global variable of type tGlobalEndpointType has been set to NULL, otherwise the server will complain.