Consultor Eletrônico



Kbase P113434: Error 4122 with Asynchronous AppServer code example
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   14/02/2006
Status: Unverified

FACT(s) (Environment):

Progress 10.x

SYMPTOM(s):

Invalid widget handle used in WAIT-FOR statement. WAIT-FOR terminated. (4122)

The example code is taken from the "OpenEdge Application Server: Developing AppServer Applications" manual

The example code for the client 4GL code on page 3-53 is

/* client.p */

DEFINE VARIABLE async-request AS HANDLE.
DEFINE VARIABLE s-hdl AS HANDLE.
DEFINE VARIABLE customer-name as CHARACTER INITIAL "WILNER".
DEFINE VARIABLE ret AS LOGICAL.
CREATE SERVER s-hdl.

ret = s-hdl:CONNECT("-S 5162 -H localhost -AppService asbroker1").

RUN server.p ON s-hdl
ASYNCHRONOUS SET async-request
EVENT-PROCEDURE "GetCustNum"
(INPUT customer-name, OUTPUT customer-number AS INTEGER).
WAIT-FOR PROCEDURE-COMPLETE OF async-request.

PROCEDURE GetCustNum:

DEFINE INPUT PARAMETER customer-number AS INTEGER.
DISPLAY customer-number.
DELETE OBJECT SELF.
END.


CAUSE:

In the internal procedure "GetCustNum", deleting object self causes the procedure to be deleted, therefore, it passes unknown value to the handle .
PROCEDURE eproc1:
DEFINE INPUT PARAMETER y AS CHAR.
DISPLAY y.
DELETE OBJECT self.
END.

FIX:

The workaround is to not delete object self inside the procedure itself.