This is the SOAP request header handler (ReqHandler) that reuses the initial SOAP response header to pass the AccessID value between the client and Web service:
Request header handler reusing a saved SOAP response header
PROCEDURE ReqHandler: /*1*/ DEFINE OUTPUT PARAMETER hHeader AS HANDLE.
DEFINE INPUT PARAMETER cNamespace AS CHARACTER.
DEFINE INPUT PARAMETER cLocalNS AS CHARACTER.
DEFINE OUTPUT PARAMETER lDeleteOnDone AS LOGICAL.
/* The IF test determines if this is the first request. If it is, then
g_header is not set and hHeader is set to ? to ensure that no header is
sent. g_header gets set when the response header is returned, so a
subsequent pass through this code takes the previous response header and
sends it as the current request header. */
IF NOT VALID-HANDLE (g_header) THEN DO: /*2a*/ /* first request */
hHeader = ?. lDeleteOnDone = TRUE. END.
ELSE DO: /*2b*/ /* all subsequent requests */
hHeader = g_header. lDeleteOnDone = FALSE. END.
END PROCEDURE.
The code in the preceding example:
1. Sends the SOAP request header for the HelloWorld request (and any request run after running OpenAccess)
2. Tests if the global header handle (g_header) references a valid object, and:
a. If it does not reference an object, the request handler must be running as part of the initial call to OpenAccess and sets the output parameters to ensure that no initial SOAP request header is sent.
b. If it does reference an object, the handler passes the global header object as output using the request header parameter (hHeader) and ensures that the object is not deleted (saving it for use in any further request).