Errors using a WCF Client to connect to NAV Web Service

TFCrowtherTFCrowther Member Posts: 35
edited 2010-03-27 in NAV Three Tier
Here is the details of the WCF Client configuration:
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
            basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

            string endPointAddr = "http://localhost:7047/DynamicsNAV/WS/Vulcan/Page/Customer";
            EndpointAddress endpointAddress = new EndpointAddress(endPointAddr);

            Customer_PortClient customer_PortClient = new Customer_PortClient(basicHttpBinding, endpointAddress);
            customer_PortClient.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;

Running the above to execute Nav 2009 Web Services returns this error:

System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header
received from the server was 'Negotiate'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.


If we remove the last line (customer_PortClient.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation), this error is returned:

System.ServiceModel.FaultException: Access denied. Delegation or Impersonation permission is required for access.


Any suggestions on how to resolve this?

Thanks

Toby

Comments

  • kinekine Member Posts: 12,562
    Instead all the things around credentials you can only set the UseDefaultCredentials to true and you are done.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • jdellatorrejdellatorre Member Posts: 7
    Hi!

    I have a similar problem. I try to connect a WCF Content type (external list) to a Sharepoint 2010 list.
    I did it over Web Service and C# but my requirements state that it should be done over BCS.

    The error on the page is the following:
    - Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
    In the log I have found:
    - You don't have Add and Customize Pages permissions required to perform this action.

    Even though I am using an administrator account which has owner permissions...
    Did I miss somewhere to set permissions?

    Thanks for your help!

    Btw. TFCrowther I see are from New Zealand. I envy you. I spend the last year there, but had to return 3 months ago.
  • KrisRafnssonKrisRafnsson Member Posts: 1
    Hi TFCrowther and jdellatorre

    You don't give me much to go on.
    However reading through the posts I got an idea of what might be wrong on your setup.
    You might be running to new Visual Studio. NAV Web Services where written to work well with how VS does things.
    Problem was that VS changed how it does things. 2008 does WS little bit differently than previous versions.
    You can however ask it to treat it like it is older version and then you should be fine.

    I don't remember the switch name for this but some body here should be able to help you.
    But after you turn on that switch kine’s solution should work.

    thanks
    Kris Rafnsson
  • RomulRomul Member Posts: 21
    TFCrowther wrote:
    Any suggestions on how to resolve this?

    It's necessary to use "Identification" instead of "Impersonation"...
    If you will use "Identification" all the processing done in the service will run as the default user (when a call is made to the service, the service will process the request as the default user for that service).
Sign In or Register to comment.