Kbase P56442: How to relay a procedure call to the AppServer from a thin client ?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  05/11/2009 |
|
Status: Verified
GOAL:
How to relay/forward a procedure or function override to the AppServer from a thin client ?
GOAL:
How to create a client-side proxy for a server-side procedure/function ?
GOAL:
How to relay/forward a procedure or function override to the AppServer with a split SmartDataObject in ADM2?
GOAL:
Sample code to relay/forward an API call to AppServer
GOAL:
How to relay/forward an API call to AppServer?
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
FIX:
Example to forward a RUN of a custom procedure to the AppServer in a SDO:
In the AppBuilder section editor for the internal Procedure
1) Uncheck DB-REQUIRED so the code is available on both the AppServer side and the Client Proxy side
2) Use the following piece of code:
/* parameter definitions */
DEFINE hAS AS HANDLE NO-UNDO.
IF DYNAMIC-FUNCTION('getASDivision':U) = "client":U THEN
DO:
hAS = getASHandle().
RUN MyProc IN hAS (parameters). /* MyProc = internal procedure name */
RUN unbindserver(?).
END.
ELSE
DO: /*Fat client or AppServer*/
{&DB-REQUIRED-START}
/* insert code to run with database connection here */
{&DB-REQUIRED-END}
END.
Note the definition of the following preprocessors in /template/data.w: &GLOBAL-DEFINE DB-REQUIRED-START &IF {&DB-REQUIRED} &THEN
&GLOBAL-DEFINE DB-REQUIRED-END &ENDIFNote that with Dynamics, the DYNAMIC-FUNCTION calls of getASDivision and getASHandle need to be done IN TARGET-PROCEDURE in order to reach the SDO. For example:
DYNAMIC-FUNCTION('getASDivision':U IN TARGET-PROCEDURE)