SQL Procedure calling NAV WebService - Credentials

bstapylton
Member Posts: 34
Hi guys,
What fun Web Services are!
I have an assembly in SQL Server 2005 which I created using C# in .NET. A Stored Procedure in SQL is responsible for requesting a .NET function CreateInvoice(string strDocumentNo), which is responsible for calling the exposed Invoice Page Web Service (so my code uses the obj.Create(ref Invoice) call). The CreateInvoice method also gathers the appropriate data from a SQL database. Basically it's transporting an invoice from one SQL Database into NAV.
For Credentials I'm using System.Net.CredentialCache.DefaultCredentials (uses the credentials of the current security context).
If I call this SP from a .NET Application, it works fine, using the current logged-in user's credentials. So as long as that user has adequate permissions in NAV, everything should be fine.
My problem is that in the case that I need this SP to be executed automatically in SQL Server (A trigger perhaps), the security context is then the owner of the MSSQLSERVER service "Local System". I would much prefer to impersonate a different user (without changing the owner of the service), but have hit brick walls thus far.
On its face this does kind-of look like a SQL question, rather than a NAV question, so I'll put it in the SQL thread.
Edit: my apologies, I clicked submit on the wrong tab and it threw my post into the NAV forum
What fun Web Services are!
I have an assembly in SQL Server 2005 which I created using C# in .NET. A Stored Procedure in SQL is responsible for requesting a .NET function CreateInvoice(string strDocumentNo), which is responsible for calling the exposed Invoice Page Web Service (so my code uses the obj.Create(ref Invoice) call). The CreateInvoice method also gathers the appropriate data from a SQL database. Basically it's transporting an invoice from one SQL Database into NAV.
For Credentials I'm using System.Net.CredentialCache.DefaultCredentials (uses the credentials of the current security context).
If I call this SP from a .NET Application, it works fine, using the current logged-in user's credentials. So as long as that user has adequate permissions in NAV, everything should be fine.
My problem is that in the case that I need this SP to be executed automatically in SQL Server (A trigger perhaps), the security context is then the owner of the MSSQLSERVER service "Local System". I would much prefer to impersonate a different user (without changing the owner of the service), but have hit brick walls thus far.
On its face this does kind-of look like a SQL question, rather than a NAV question, so I'll put it in the SQL thread.
Edit: my apologies, I clicked submit on the wrong tab and it threw my post into the NAV forum

0
Comments
-
I think what you need is to allow delegation for you SQL server to be allowed to impersonate users towards the Service Tier.Freddy Kristiansen
Group Program Manager, Client
Microsoft Dynamics NAV
http://blogs.msdn.com/freddyk
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.0
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
- 320 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