1. Zhang JX
  2. Beta Testing
  3. Wednesday, 5 May 2021 14:12 PM UTC

Hi Team,

2 questions for help:

1. Is there PowerBuilder2021 function to get PS SessionID? I need log this session ID to DB table for analytic purpose;

2. When use below Powerscript SQL statement to insert table info directly, get below error message:

sqlca.of_begin()
If li_count > 0 Then
Update sys_session_log set update_date = :ldt_createtime, coy_code = :is_coy_code, device_id = :is_device_id where session_id = :iblob_SessionId;
Else
INSERT INTO sys_session_log (session_id, coy_code,session_date,update_date,usr_logon,device_id,comp_name)
VALUES (:iblob_SessionId,:is_coy_code,:ldt_createtime, :ldt_createtime, :is_usrlogon,:is_device_Id, :ls_ComputerName ) ;
End If
sqlca.of_commit()

SQLErrTxt: Get IE auto proxy failed

What's wrong with that? no issue with Client/server access.

-- have to add "using sqlca;"?

Thank you.

Best Regards,

JX

Accepted Answer
Zhang JX Accepted Answer Pending Moderation
  1. Saturday, 7 August 2021 00:08 AM UTC
  2. Beta Testing
  3. # Permalink

To all, an update.

With the PS2021 build1288 GA release, we are able to getsessionid from PB Script.

This query is no more applicable.

 

Thank you all.

JX

Comment
  1. Armeen Mazda @Appeon
  2. Saturday, 7 August 2021 00:26 AM UTC
Glad to hear your issue resolved!
  1. Helpful
  1. Zhang JX
  2. Saturday, 7 August 2021 01:43 AM UTC
Thanks Armeen for all the help.

JX
  1. Helpful
There are no comments made yet.
Zhang JX Accepted Answer Pending Moderation
  1. Sunday, 1 August 2021 09:10 AM UTC
  2. Beta Testing
  3. # 1

To all,

Noticed that below API call is no more working with latest PB2021 deployment(developer license):

http://<localhost>:5000/api/Custom/GetAllSessions

any idea how to get session information with PS2021 GA version?

 

Regards, 

JX

 

Comment
  1. Armeen Mazda @Appeon
  2. Sunday, 1 August 2021 15:57 PM UTC
Take a look at the Swagger in the C#+generated Web API project it documents all the APIs
  1. Helpful
There are no comments made yet.
Zhang JX Accepted Answer Pending Moderation
  1. Sunday, 9 May 2021 06:40 AM UTC
  2. Beta Testing
  3. # 2

Hi all,

One more Session Id related question for help: How to re-connect/re-activate "Running application" either re-use or re-create a session ID on PS?

On yesterday's testing, I hit 2 errors:

1) Error Number 2, Error text = Null object reference, which script: sqlca.of_begin()

2) Error number 224, Error text = The session does not exist at line13 in function....

Which caused by session timeout and no more DB connection already.

Reason of session timeout:
1. When running inventory planning report for the ERP system, it took around 2 hours to process data, while session timeout setting is 1 hour.

2. User attended to other matter and left the application there more than 1 hour, when backing to the application interface, corresponded session is not exist already.

 

I knew it is not a PB/PS related bug, while exploring the possibility to re-activate the application with a new session on PS service ==> like what we did for client/server to re-connect DB when losing DB connectivity in-between.

For now, seems that have to ignore the error or handle the message, close the application and re-launch it.

Thank you.

Best Regards.

JX

 

Comment
  1. mike S
  2. Sunday, 9 May 2021 13:56 PM UTC
You really have two choices for this:

1) move that report and similar long running processes to a service. this would be your best long term bet. Either move it to .net, or if you need to keep it in PB code then run it on a server as PB code.

2) extend the timeout to account for your 2 hour processing



for user inactivity, i just have the application itself log out the user with a message prior to the server timeout.





  1. Helpful
  1. Zhang JX
  2. Sunday, 9 May 2021 14:13 PM UTC
Okay, noted.

Thanks mike.



Regards,

JX
  1. Helpful
  1. Chris Pollach @Appeon
  2. Monday, 10 May 2021 00:11 AM UTC
Hi Mike;

I agree 100% on the background "service" approach. No long running reports should be done on a 3-4 tier architecture IMHO.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Thursday, 6 May 2021 10:33 AM UTC
  2. Beta Testing
  3. # 3

Hi Zhang JX,

 

Thanks for reporting ticket 6549. And we will handle this issue as an enhancement.

For the other issue: the SQLErrtxt is "Get IE auto proxy failed" or "Get response encoding failed".

Based on our analysis, this is a bug. We suggest that you open a new ticket in our support portal for us to better track the issue. Thanks in advance.

 

Regards,

Comment
  1. Zhang JX
  2. Thursday, 6 May 2021 10:38 AM UTC
Hi Mark,

Appreciated!

Okay, I will submit a support ticket on the SQLErrtxt issue later.

Regards,

JX
  1. Helpful
There are no comments made yet.
Julie Jiang @Appeon Accepted Answer Pending Moderation
  1. Thursday, 6 May 2021 07:36 AM UTC
  2. Beta Testing
  3. # 4

Hi Jianxin/Mike/Chris, 

It is not documented yet (we will add into the Release Bulletin right away), but the beta version already allows you to get all sessions or kill a session. 

1,Call the /api/custom/getAllsessions to get all sessions; 

2,Call the /api/custom/KillSession to kill a session of a given sessionid; 

3,The session information returned from PowerServer is as below:

[{"sessionid":"85b78052-8692-4281-82e9-dbbefed31055","sessionstate":2,"createtime":"2021-05-06T03:35:30.7323321Z","lastvisittime":"2021-05-06T03:39:25.4715132Z"},{"sessionid":"ca54aa7d-5fd6-429a-a2c0-494eb3be820d","sessionstate":2,"createtime":"2021-05-06T03:35:21.0329275Z","lastvisittime":"2021-05-06T03:35:24.5604784Z"}]

Here are the sample scripts.

//-------------------------------------getSession-----------------------------------------

httpclient  lhc_client

string ls_url

string ls_json

 

lhc_client = create httpclient

//GetSessions

ls_url = "http://localhost:5000/api/custom/getAllsessions"

//You may need to change to the actual ipaddress:port

//If there are multiple PowerServers, you can get the sessions separately for each server.

//lhc_client.SetRequestHeader("Authorization", $token, true)  //If authorization is enabled

lhc_client.sendrequest("Get",ls_url)

 

if lhc_client.getresponsestatuscode() = 200 then

                lhc_client.getresponsebody(ls_json)

                //parse the json

                wf_getsessions(ls_json)

end if

 

//-------------------------------------------------------------------------------------------------

 

//-------------------------------------killSession-----------------------------------------------

 

httpclient  lhc_client

string ls_url

string ls_sessionid

 

lhc_client = create httpclient

//GetSessions

//lhc_client.SetRequestHeader("Authorization", $token, true)  //If authorization is enabled

ls_url = "http://localhost:5000/api/custom/KillSession"

 

ls_sessionid = lb_sessionlist.selecteditem()

ls_url += "/"+ls_sessionid

 

lhc_client.sendrequest("post",ls_url)

 

if lhc_client.getresponsestatuscode() = 200 then

                messagebox("succeed",ls_sessionid +" was killed")

end if

//-------------------------------------------------------------------------------------------------------------------

 

Best regards, Julie

 

 

Comment
  1. Julie Jiang @Appeon
  2. Saturday, 8 May 2021 08:51 AM UTC
Hi JX,

There is a line in the sample scripts:

//lhc_client.SetRequestHeader("Authorization", $token, true) //If authorization is enabled



This means that you can enable PowerServer authorization and require all requests to add the header for authorization.



Best regards, Julie
  1. Helpful
  1. Zhang JX
  2. Sunday, 9 May 2021 06:15 AM UTC
Thanks Julie,

Will study and try this option.



Regards,

JX
  1. Helpful
  1. Zhang JX
  2. Sunday, 9 May 2021 09:14 AM UTC
Hi Julie,

Noticed that below URL for Oauth taken setup in PB Help document:

==> options.Authority = "https://localhost:5001";

is this part of PS components, or are we have to build on our own?



Thanks,

JX

  1. Helpful
There are no comments made yet.
Zhang JX Accepted Answer Pending Moderation
  1. Thursday, 6 May 2021 06:25 AM UTC
  2. Beta Testing
  3. # 5

To all, FYI.

I have solved this issue by amending the session_id from UID to be nchar(36), will leave it to Appeon team to trace on UID(or possible other issue).

Thanks

JX

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 5 May 2021 15:09 PM UTC
  2. Beta Testing
  3. # 6

Hi JX;

  1. FYI: We already have an enhancement suggestion for access to the Session ID from the PS2021 "Preview". AFAIK: No Session ID access yet in the 1st Beta.
  2. Did adding the USING clause make it work OK?

Regards ... Chris

Comment
  1. mike S
  2. Wednesday, 5 May 2021 16:04 PM UTC
-->"enhancement suggestion for access to the Session ID"



if it is missing, then it will be a deal breaker. it's licensed by sessions, so obviously it is available and just needs to make it available to us, along with similar things like the full list of current sessions in use, runtime create of database connections, etc.

i can't really even test it until they make the powerserver 2020 functionality available
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 5 May 2021 17:58 PM UTC
Hi Guys ... Please create a Support Ticket for these PB / PS2021 items as an enhancement request. The more PB Developers request this, the more Engineering will prioritize.
  1. Helpful
  1. Zhang JX
  2. Thursday, 6 May 2021 03:08 AM UTC
Hi Chris,

ok, for sessionID, I will create a support ticket.

For item 2, still failed to insert this session info, in the same script block, i am able to insert similar record to access_log table.

only different is this sessionID is UID with a value get from SQL newid().

When I used https to connect Web API, the SQLErrtxt is "Get IE auto proxy failed"

today I switched back to http to connect WEB API, the SQLErrtxt = "Get response encoding failed"



Thank you.

JX
  1. Helpful
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.