0
votes

We have written a small monitoring web site for our customer that shows the current status of their Navision system.

This was done by creating a codeunit that has a number of functions that gather data and counts for job queues etc and published the data through a page, which has been configured to be used as a web service.

The website then calls this web service and displays the data dynamically.

My question is this.

One of the counts that the codeunit creates is the number of Sessions (from the Virtual table "Session") where the Application Name is either "Microsoft Dynamics NAV Classic client" or "Application Server for Microsoft Dynamics NAV Classic". When the codeunit is run from Navision (and displayed in a list form, or displayed in an RTC page) then the correct count is displayed.

However, when calling the published page as a web service using ASP.Net, the count is always 0.

It seems the web service is somehow, unable or unwilling to give us this count.

The code in the codeunit that gets this count is as follows.

tblSession.RESET;
tblSession.SETFILTER("Application Name",
                'Microsoft Dynamics NAV Classic client|Application Server for Microsoft Dynamics NAV Classic');
intValue := tblSession.COUNT;

I have even tried writing a brand new codeunit just to get the count of sessions by itterating through them, checking the Application Name, and if its one of our chosen types, incrementing a count, and returning this as a return parameter in the function. It still returns 0.

Has anyone else experienced this, or does anyone know why the data does not carry through the web service?

1
Are your web services running on a different middle tier server instance? If so then that would explain it since the client sessions are limited to their own server instance. - WiredWiz
From what I can tell it looks like you will not be able to rely on the Session table. Even if you execute some code from the dev client to display a message with the Session record count, it returns 1 (at least under 2015). You will likely have to resort to some other means to get a count of logged in users (perhaps querying sql?). - WiredWiz
Sorry, but perhaps I should have specified that this client is running old v2 objects with the 2009 client. It seems that the Active Sessions table only monitors users going through the middle tiers where we need to display the users that are connected using the classic client and any NAS's. - Karl

1 Answers

0
votes

It appears that in Nav 2015 there is a table named "Active Session". If you want a count of the current sessions, try counting the records from this table instead.