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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Authentication failure in HTTP adapter

(0) ShareShare
ReportReport
Posted on by 4,624

Hi,

I am exchanging document using HTTP adapter. So I consumed this services in visual studio and wrote below code:

static void Main(string[] args)
        {// Create the sales order objects
    // Service client
    ServiceReference1.SalesOrderServiceClient cl = new ServiceReference1.SalesOrderServiceClient();
    // Sales order object to receive response
    Test.ServiceReference1.AxdEntity_SalesTable[] resp;

    // Create the entity key list for the request
    ServiceReference1.EntityKey[] readRespKeys = new ServiceReference1.EntityKey[1];
    readRespKeys[0] = new ServiceReference1.EntityKey();
    readRespKeys[0].KeyData = new ServiceReference1.KeyField[1];
    readRespKeys[0].KeyData[0] = new ServiceReference1.KeyField();
    readRespKeys[0].KeyData[0].Field = "SalesId";

    // Ask the user for a sales order ID
    Console.WriteLine("Enter the sales order ID:");
    // Add the result to the entity key value
    readRespKeys[0].KeyData[0].Value = Console.ReadLine();

    try
    {
        // Try to read the sales order
         resp = cl.read(null, readRespKeys);

        // Display the information from the first sales table
        Console.WriteLine("For sales order: " + resp[0]);
        Console.ReadKey();
      //  Console.WriteLine("Customer Account is: " + resp.SalesTable[0].CustAccount);
    }
    catch (Exception e)
    {
        Console.WriteLine("Exception: " + e.Message);
        cl.Abort();
    }
    cl.Close();


But this is working as excepted so i used debugger to see whats happening and it throw an exception , please see below:

0638.exception.PNG\

please suggest me the solution.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    239,257 Most Valuable Professional on at

    Your title, "Exchanging Document using HTTP adapter in AX", is too generic (maybe because you again try to create one huge thread about several different questions). Let me make it more descriptive.

  • Rohin Profile Picture
    4,624 on at

    thanks Martin for correcting this. Now is it possible for you to help me?

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    I cannot see an account being passed in as authentication to your service, so it tries to pass in the current execution context from your logged in user.

    Have a look at the following topic for example:

    community.dynamics.com/.../246784

    Also your IIS setup/web service might be incorrectly set for security/authentication.

    Finally, consider setting up Kerberos instead of NTLM authentication if nothing else works - that would require a System engineer with Domain administrator rights due to the need of changing/adding SPN values.

    https://blogs.msdn.microsoft.com/chiranth/2014/04/17/setting-up-kerberos-authentication-for-a-website-in-iis/

  • Martin Dráb Profile Picture
    239,257 Most Valuable Professional on at

    Please give us more information. First of all, what bindings are you using?

  • Rohin Profile Picture
    4,624 on at

    Martin, I using HTTP binding.

  • Rohin Profile Picture
    4,624 on at

    Vilmos,

     I add code for passing user credentials but now its throw exception : "Failed to logon to Microsoft Dynamics AX."  

  • Martin Dráb Profile Picture
    239,257 Most Valuable Professional on at

    Of course, it's the HTTP protocol. But which type of binding?

    I thought you wanted to use credentials of the current user, not specifying them in code. Please explain your intention regarding authentication; we can't give you a solution if we don't know your goal.

  • Rohin Profile Picture
    4,624 on at

    exactly Martin, I wanted to use of current user credentials. How to do that?

    about Binding, i don't know what exactly you are asking...can you please clear it to me?

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    That error message is now better, since the original error came from the authentication tier of the web service, while the failed to logon came from the AX kernel. Now all you need to do is pass in a credential which is correct, including domain and user account.

  • Martin Dráb Profile Picture
    239,257 Most Valuable Professional on at

    You're using WCF (Windows Communication Foundation), so it will help you if you learn how it works (from high-level perspective).

    WCF services are highly configurable - you can change which protocol they'll use, which kind of authentication, security and so on just by modifying configuration files.

    There is a configuration of the service (in AX, it's on inbound ports) and in the client application. In your case, find App.config file in your Visual Studio project, and either open it as text or right-click it and choose Edit WCF Configuration. There is where you can see and change the client configuration.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 4 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans