Step 3: Publish a web service operation returning the W3CEndpointReference state variable and set it as session initiator
You must define which web service operation will initiate the session on your service and return the W3CEndpointReference state variable.
All other web service operations (not defined as session initiator) will return an error if they don't get reference parameters defined in the W3CEndpointReference state variable as WS-Addressing 1.0 headers.
DEFINE op com.WebOperation
LET op = com.WebOperation.CreateDocStyle("GetInstance",
"GetInstance",NULL,EndpointReferenceState)
CALL op.initiateSession(TRUE)
CALL serv.publishOperation(op,NULL)
There is no restriction regarding the input parameter of the web service initiator function, but the output parameter must be the same W3CEndpointReference record passed to the service creation constructor.
It is not required to have a web operation which initiate the session in the same service, but then you have to return the same W3CEndpointReference record in another web service to instantiate the session, such as a Factory service that instantiates all sessions for other stateful services.