project BLF > class PAuthentication > method Logout

Description

logout API


Parameters


tLogoutSessionTokeninputtemp-table
tResponseCodeoutputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method Session.ExitInstance
method Session.ValidateLogin


program code (program1/pauthentication.p)

If oiReturnStatus = 0
Then Assign oiReturnStatus = -98.

/* ==================================================================================================== */
/*  Make sure the right global session is used when activating the MfgPro session.                      */
/* ==================================================================================================== */
find first tLogoutSessionToken no-error.
if not available tLogoutSessionToken
then do:
    <M-2 run SetMessage
          (input  #T-3'The Global Session ID is not known in this call.':60(8155)T-3# (icMessage), 
           input  '' (icArguments), 
           input  '' (icFieldName), 
           input  '' (icFieldValue), 
           input  'S':U (icType), 
           input  1 (iiSeverity), 
           input  '' (icRowid), 
           input  'BLF-358':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
    assign oireturnstatus = -1.
end.
else assign vcGlobalSessionId = tLogoutSessionToken.tcMfgSessionId.
<M-4 run SetQadContextProperty
   (input  'SessionId' (icPropertyName), 
    input  vcGlobalSessionId (icPropertyValue), 
    output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
if viFcReturnSuper <> 0
then do:
    assign oiReturnStatus = viFcReturnSuper.
    <M-7 run SetMessage
       (input  #T-8'The -$1- property could not be set in the internal service context.':100(8066)T-8# (icMessage), 
        input  'SessionId':U (icArguments), 
        input  '' (icFieldName), 
        input  '' (icFieldValue), 
        input  'S':U (icType), 
        input  1 (iiSeverity), 
        input  '' (icRowid), 
        input  'BLF-359':U (icFcMsgNumber), 
        input  'The internal context property could not be set.  This is an internal error.':U (icFcExplanation), 
        input  '' (icFcIdentification), 
        input  '' (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
    leave.
end.

empty temp-table ttLogoutSessionToken.

for each tLogoutSessionToken:
    create ttLogoutSessionToken.
    assign ttLogoutSessionToken.tt_session_id = tLogoutSessionToken.tcMfgSessionId.
end.

assign vhIn = dataset dsASLogoutRequest:handle
       vhOut = dataset dsASGeneralResponse:handle
       vhInOut = ?.

Create Dataset vhInOut in widget-pool "non-persistent".
vhInOut:name = "CallService".

<M-1 run CallService
   (input  '':U (icProgramName), 
    input  'logout':U (icMethodName), 
    input  vhIn By-reference (izInput), 
    input-output vhInOut By-reference (bzInputOutput), 
    input-output vhOut By-reference (bzOutput), 
    input  '' (icAsyncHandler), 
    output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
If viFcReturnSuper <> 0
Then Assign oiReturnStatus = viFcReturnSuper.
If viFcReturnSuper < 0
then do:
    delete object vhInOut.
    return.
end.

empty temp-table tResponseCode.

for each  ttResponseCode :
    create tResponseCode.
    assign tResponseCode.tcResponseCode = ttResponseCode.tt_responseCode.
end.

delete object vhInOut.

If oiReturnStatus = -98
Then Assign oiReturnStatus = 0.