web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

2013 R2 Web Services in Visual Studio

(0) ShareShare
ReportReport
Posted on by 240

Earlier in the year, we were beginning to transition to 2013 R2.  During the process I created a C# application to import exchange rates through the web services daily.  Everything worked great, but our transition never got completed.  We are starting a new transition now, from scratch.  I'm trying to reconfigure my application to use the new NAV instance, but I'm having trouble discovering the Web Service.  From what I can tell, I have configured the new instance exactly like the old one.  However, when I paste the SOAP url into the "Add Service Reference", it prompts me for a username and password but won't accept any form of my credentials, i.e. username, domain\username, username@domain .  When I paste the old instance's SOAP url, it works fine.  Also, if I put the new instance's url into a browser, it will prompt me for a username and password, but once I put in my credentials, it works fine.

I feel like I ran into this issue when I originally did it, but it was nearly a year ago and I don't remember what I did to correct it.  Hopefully somebody has experience and it is a simple misconfiguration somewhere.  Thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    keoma Profile Picture
    32,729 on at

    hi,

    did you change the web service binding?

    what do you use as binding (http binding, ...)?

    what kind of security do you use there?

    try to develope a complete new c# test app and add the nav web service as web (!) service reference (not wcf service ref.).

  • boonec6 Profile Picture
    240 on at

    Thanks for your response, Jonathan.

    I'm not sure about the web service binding... is that on the NAV side or my C# application?  If it's on the NAV side, the only configuration I've done is to publish the page and ensured that SOAP services were enabled.

    I think the error is occurring before the binding comes into effect.  Using the "Add Service Reference" wizard, it requests credentials immediately upon clicking "Go".  If I use the url from the old environment, which is still active, it works fine.  

    I am able to get the new web service to work if I Enable NTLM Authentication in the NAV 2013 R2 Administration tool, but in the old environment, that is not enabled, and I'm under the impression that it is best not to enable NTLM.

    I'm using BasicHttpBinding, with the Security Mode as TransportCredentialOnly, and the ClientCredentialType is HttpClientCredentialType.Windows.  

    Trying to start from scratch gave me the same result when adding the Web Service Reference.

    The error message is: (this is received after cancelling out of the credential requests, if I use credentials, the prompt repeats continuously)

    The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate'.

    The remote server returned an error: (401) Unauthorized.

    If the service is defined in the current solution, try building the solution and adding the service reference again.

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    check the web.config (or app.config) on c# side.

    and check the webservice settings on nav side (customsettings.config).

    did you really add the nav webservice as .net web service ref. or as wcf service ref.? this error is a typical wcf error.

    the web service goes with: add service reference, button left/bottom corner --> add as web reference.

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    [quote][/quote]

    check the web.config (or app.config) on c# side.

    and check the webservice settings on nav side (customsettings.config).

    did you really add the nav webservice as .net web service ref. or as wcf service ref.? this error is a typical wcf error.

    the web service goes with: add service reference, button left/bottom corner --> add as web reference.

    Or else open your solution in visual studio and in the reference folder you will find all your web references. Right click on them and go to properties. In that you will see the current binding link. Check that link is properly set and if not change it and update it. 

  • keoma Profile Picture
    32,729 on at

    tharanga is right. if you didn't it, update the web reference in your c# project (maybe one, twice). unfortunately it is possible that the web reference file is broken. i had that case at least once. only way, start again. also maybe helpful: remove the published nav web service entry in the nav web service table and recreate the entry.

  • boonec6 Profile Picture
    240 on at

    Both config files look correct, to me at least.  The app.config file is using basicHttpBinding.  The customsettings.config file shows the webservices enabled.

    Yes, I am trying to add as a .net web service reference.

    Normally I am able to add the url here and have it work: 

    addwebref.PNG

    I have also tried clicking Advanced, then Add Web Reference, and tried adding the url here:

    At the moment, I have it working, using NTLM.  Is there a drawback to leaving it configured this way?

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    Did you try this with a completely new project?  My suggestion is to try it with a fresh project ans see.

  • keoma Profile Picture
    32,729 on at

    does it work now using the "add web reference" method?

    did you need credentials?

    how do you set the credentials in the c# code?

  • boonec6 Profile Picture
    240 on at

    Tharanga,

    I did try a completely new project and ran into the same issue.  I'm afraid that there is an authentication setting on the new server that is different that I'm not aware of.  I'll have to contact the person who created the server to see if he is aware of any different settings between the 2 servers regarding authentication.

    Jonathan,

    Both the standard Service Reference and the Add Web Reference methods work while I have "Use NTLM Authentication" enabled.

    Neither of them work when NTLM is not enabled.  Both methods prompt for username and password, but will not accept my credentials.  They repeatedly prompt until I cancel out.

  • boonec6 Profile Picture
    240 on at

    I have not in the past set credentials within C#, it has used always passed Windows Credentials.

                BasicHttpBinding basicHttpBinding1 = new BasicHttpBinding();
                basicHttpBinding1.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
                basicHttpBinding1.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans