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

Call the BDL function generated from the WSDL that is defined as session initiator on the server. This function returns a W3CEndpointReference parameter that contains the WS-Addressing 1.0 reference parameters representing the new instance created on server side.

If your application handles several instances, you will have to copy and store those parameters in your application to identify a service instance for further requests.

As the WS-Addressing 1.0 reference parameters are defined as an XML document, they are represented as a dynamic list of xml.DomDocument in BDL.

For example:

DISPLAY "Creating a new instance ..."
LET wsstatus = GetInstance_g() # call the service session initiator 
                               # web function
IF wsstatus == 0 THEN
   FOR ind=1 TO
     ns1GetInstanceResponse.return.ReferenceParameters._LIST_0.getLength()
      LET instance1[ind]=
        ns1GetInstanceResponse.return.ReferenceParameters._LIST_0[ind].clone() 
        # copy the service returned WS-Addressing 1.0 reference parameters
   END FOR
ELSE
     ... handle soap errors
END IF
Important:

When creating a new instance, ensure that the Parameters member of the generated global variable of type tWSAGlobalEndpointType has been set to NULL, otherwise the server will throw an error.