Consultor Eletrônico



Kbase P17412: Can a client procedure obtain a client-side handle of a persistent procedure initiated by the Startu
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/10/2008
Status: Verified

GOAL:

Can a client procedure obtain a client-side handle of a persistent procedure initiated by the Startup procedure of an AppServer process in order to execute an internal procedure in the remote persistent procedure?

FACT(s) (Environment):

Progress 9.x

FIX:

The handle of a persistent procedure that was initiated by the startup procedure of an AppServer can be retrieved by calling a program on the AppServer that returns this data. The problem is that the handle cannot be used by the client to actually run something in that handle (since the client did not instantiate the persistent procedure the handle is not defined as being remote so the run statement will not work).

Therefore, it is not possible to make a remote persistent procedure a super procedure of a client procedure. However, the remote persistent procedure can be made a session super procedure on the AppServer and then other programs that are invoked on the AppServer can make calls to the super procedure's internal procedures. e.g.:

/*** startProc.p - appserver's startup procedure ***/

DEFINE INPUT PARAMETER pcInitParam AS CHARACTER NO-UNDO.

SESSION:ADD-SUPER-PROC(THIS-PROCEDURE).

PROCEDURE procSample:
DEFINE OUTPUT PARAMETER pcProcValue AS CHARACTER NO-UNDO INITIAL 'testProcedureServerValue'.
END PROCEDURE.

/*** conectAppSvr.p - client's connect procedure ***/

DEFINE VARIABLE vhSvrHdl  AS HANDLE    NO-UNDO.
DEFINE VARIABLE vhProcHdl AS HANDLE    NO-UNDO.
DEFINE VARIABLE vcProcVal AS CHARACTER NO-UNDO.

CREATE SERVER vhSvrHdl.

vhSvrHdl:CONNECT("-AppService asbroker1":U,"":U,"":U).

RUN getStartProcHdl.p ON SERVER vhSvrHdl (OUTPUT vhProcHdl, OUTPUT vcProcVal).

MESSAGE "Server Handle - ":U vhProcHdl SKIP
       "Procedure Server Value - ":U vcProcVal VIEW-AS ALERT-BOX.

vhSvrHdl:DISCONNECT().

DELETE OBJECT vhSvrHdl.

/*** getStartProcHdl.p - program invoked on the AppServer that makes ***/
/*** calls to the super procedure's internal procedure ***/

DEFINE OUTPUT PARAMETER phStartProcHdl AS HANDLE    NO-UNDO.
DEFINE OUTPUT PARAMETER pcProcValue    AS CHARACTER NO-UNDO.

ASSIGN phStartProcHdl = SESSION:FIRST-PROCEDURE.

RUN procSample(OUTPUT pcProcValue).