Server Module Session Handling VLWEB

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Server Module Session Handling VLWEB

Post by soa »

I've set up a server module routine to issue a startsession and a second one to specify Session(*Required). If I call the second routine after a successful start session call it all works fine.

If I remove the startsession call to test what happens if the session is not there I'm getting javascript error

LESERVER.LOADLANGUAGESCENTRES: Invalid Web application session.

While this is correct I expect to receive a Failed event so I can handle it gracefully. Crashing is no good to me. What am I doing wrong.

#LoadLangCentres.ExecuteAsync(...

Evtroutine Handling(#LoadLangCentres.Completed)
...

Evtroutine Handling(#LoadLangCentres.Failed) Reason(#REASON)

Signal Event(LoadLangCentresFailed)

Signal Event(ServerModuleFail) Function("LOADLANGUAGEANDCENTRES") Reason(#REASON)

Endroutine
JamesDuignan
Posts: 85
Joined: Thu Nov 26, 2015 1:43 pm

Re: Server Module Session Handling VLWEB

Post by JamesDuignan »

Hi Jim,

I suspect that it is still crashing on the failed event is because you have not set the handled selector to true.

Your code should look like the following:

Code: Select all


Evtroutine Handling(#LoadLangCentres.Failed) Reason(#REASON) Handled(#Handled)

#Handled := True

Signal Event(LoadLangCentresFailed)

Signal Event(ServerModuleFail) Function("LOADLANGUAGEANDCENTRES") Reason(#REASON)

Endroutine


Also you can set a global event for failed requests to the server module using the #SYS_WEB.RequestFailed event.

This will elevate the need to write a new failed event for each call to the servermodule.

Code: Select all

Evtroutine Handling(#SYS_WEB.RequestFailed) Handled(#Handled) Reason(#Reason) Request(#Request)


#Handled := True


#SYS_WEB.Alert( #Reason  )

Endroutine

Regards,
James Duignan
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Re: Server Module Session Handling VLWEB

Post by soa »

Thanks James.
Post Reply