1. Jim Nesbitt
  2. PowerServer
  3. Tuesday, 20 June 2023 12:01 PM UTC

Hi 

I followed the instructions for AD authorisation in the PowerServer docs. The code makes a call to BeginSession so that it has the AD Authorisation details when connecting. This all works fine. 

 

I want to begin a new session following a session timeout, so I catch the error and rerun the same function used initially to restart the session as if from the beginning, but I get a -1 from the BeginSession call and Getapplication().GetHttpResponseStatusText() isn't returning any message.

 

I'm using LongConnection=1 for the DBCache connection, and I'm working on a Saas Model, so config details are held in the DB (PowerServer_ApplicationConfig, PowerServer_TransactionConfig, PowerServer_ConnectionConfig).

The code works for the initial login with either a Windows Login or an AD User name and password. I'm catching a 224 error.

Session fails to respond (Session does not exist). Please close or restart the application. (Web API: http://localhost:5099/api/ServerApi/RetrieveWithParm)

Is there something I'm missing?

Cheers

Jim

INT ll_rc
//-------------------------------------------------------
// https://docs.appeon.com/ps2022/Azure_Active_Directory.html#Modifying_the_PowerBuilder_client_app_for_Azure_AD
// *AD Authentication* STEP 5
//-------------------------------------------------------
Choose Case error.Number
 Case 225 , 224  //Session Timeout Error - session does not exist
	ll_rc = SQLCA.of_reconnect()
	if ll_rc = -1 THEN
		HALT CLOSE
	END IF
		
 Case 220  to 229 //Session Error
  MessageBox ("Session Error", "Number:" + String(error.Number) + "~r~nText:" + error.Text )
 Case 230  to 239 //License Error
  MessageBox ("License Error", "Number:" + String(error.Number) + "~r~nText:" + error.Text )
 Case 240  to 249 //Token Error
  MessageBox ("Token Error", "Number:" + String(error.Number) + "~r~nText:" + error.Text )
  //Authorization
  gnv_app.of_Authorization()
 Case Else
	// Call ancestor system error
	CALL SUPER::pfc_Systemerror
End Choose

 

 

 

 

 

Accepted Answer
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Friday, 23 June 2023 11:07 AM UTC
  2. PowerServer
  3. # Permalink

Hi Jim,

Please notice that you can only call BeginSession to create one session one time after the application started. If a session has ever been created successfully, the BeginSession method will not work if called the second time. 

It means you have to restart the application after catching the "Session does not exist" error.

Regards, Logan

 

Comment
There are no comments made yet.
Jim Nesbitt Accepted Answer Pending Moderation
  1. Friday, 23 June 2023 11:30 AM UTC
  2. PowerServer
  3. # 1

Hi Logan

I had a further look at the documentation and thought that might be the case, but wasn't sure. I was trying to get the PowerServer app to continue if the web server recycled instead of having to log in again. 

All good.

Cheers

Jim

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.