License for Web Service
chrisdf
Member Posts: 82
Hi,
I am developing with an Internet application using web services to write to NAV2009. The web developer has to log into the NAV database and is granted a user license which is relinquished after the web service is complete. If there are no user licenses available then the web application fails to log into NAV.
Does anyone know a way to "allocate" a user license permanently to the web service application so that the web application can always log into NAV ??? A bit like the NAS service that has a user license constantly.
Thanks.
I am developing with an Internet application using web services to write to NAV2009. The web developer has to log into the NAV database and is granted a user license which is relinquished after the web service is complete. If there are no user licenses available then the web application fails to log into NAV.
Does anyone know a way to "allocate" a user license permanently to the web service application so that the web application can always log into NAV ??? A bit like the NAS service that has a user license constantly.
Thanks.
0
Comments
-
Shouldn't the web service be using a DCO license? And since that is not concurrent it should always be open, if nothing else is using it.0
-
Hi,
Thanks for your reply - as I understand it - DCO does not affect user connectivity, it is simply an "honesty" measure.
I think I have come up with a way to do this - have to keep a table of logins and then control it from Codeunit 1 to error if the number of logins gets to "one less" than the maximum number of licenses available, therefore keeping one license for the middle tier to get in.
Just seems like something Microsoft would have thought about ... ah well!0 -
Nope - can't control the user log-in from Codeunit 1, by the time Codeunit 1 is executing, the log in has connected so any statement with an "ERROR" command in it won't work.
It does seem though that this can be controlled if the database is SQL.
Section 30.7 of the w1w1adg.pdf outlines how you can create a stored proceedure to execute at log-in time. With the right bit of coding this seems to work. What I did was as follows.
1. In NAV created some setup fields to hold the max number of licenses and the userid of the web services account.(Table "System Setup" )
2. Created a new table in NAV to log users connected to the system. (Table "User Log On")
3. Populated this table from Codeunit 1 (log-in) and deleted the entry from Codeunit 1 (log-out). The web services account should be excluded from logging in this table.
4. Wrote the stored procedure similar to the example and excluded the web user account from being tested. The SP looks something like this (my SQL coding is not the best but it seems to work!):
So if the system has 10 licenses, it only allows nine to be used (by accounts other than the web services account).
USE <DB Name>
IF EXISTS (SELECT name FROM sysobjects
WHERE name = 'sp_$ndo$loginproc' AND type = 'P')
DROP PROCEDURE [sp_$ndo$loginproc]
GO
CREATE PROCEDURE [sp_$ndo$loginproc]
@appname VARCHAR(64) = NULL,
@appversion VARCHAR(16) = NULL
AS
BEGIN
DECLARE @LicenseCount INT, @AlreadyLoggedIn INT, @WebUserID VARCHAR(30)
SELECT @LicenseCount = [License Count], @WebUserID = [Web User ID]
FROM [<DB Name>].[dbo].[ <Company Name>$System Set Up]
IF suser_sname() <> @WebUserID
BEGIN
SELECT * FROM [<DB Name>].[dbo].[User Logon]
SET @ROWCOUNT
IF (@LicenseCount - @AlreadyLoggedIn) < = 1
RAISERROR ('The maximum user count has been reached.', 11, 1)
END
END
GO
GRANT EXECUTE ON [sp_$ndo$loginproc] TO public
GO0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
