Options

SQL Procedure calling NAV WebService - Credentials

bstapyltonbstapylton Member Posts: 34
edited 2009-03-12 in NAV Three Tier
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 :(

Comments

  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    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.
Sign In or Register to comment.