Try OpenEdge Now
skip to main content
Application Migration and Development Guide
Application Development with PAS for OpenEdge : Programming ABL Client Applications : Connecting to a PAS for OpenEdge instance : Connection examples : Connecting to a session-managed PAS for OpenEdge instance
 
Connecting to a session-managed PAS for OpenEdge instance
In this session-managed connection example, the -URL parameter for the local PAS for OE instance passed as the connection-parameters argument to the CONNECT( ) method. Specific userid and password values are also passed as arguments to the Connect procedure configured for the instance. A value is not supplied as a appserver-info argument, which the procedure receives as the Unknown value (?). For example:
DEFINE VARIABLE hAppSrv AS HANDLE  NO-UNDO.
DEFINE VARIABLE lReturn AS LOGICAL NO-UNDO.

CREATE SERVER hAppSrv.
lReturn = hAppSrv:CONNECT
  ("-URL http://slater:OuterLimits64@localhost:8810/inventory/apsv","SMITH","StarShip90").
IF NOT lReturn THEN DO:
  DELETE OBJECT hAppSrv NO-ERROR.
  RETURN ERROR "Failed to connect to the inventory ABL web application: " + RETURN-VALUE.
END.
. . .
lReturn = hAppSrv:DISCONNECT().
DELETE OBJECT hAppSrv NO-ERROR.
This code tries to connect to the inventory OE ABL Web application running on the local instance and authenticates the connection for user slater with the password, OuterLimits64.
If the Connect procedure fails, it can specify a user-defined string. Appending the RETURN-VALUE function to a generic error message in your client-side connection code can capture any user-defined string returned by the Connect procedure.