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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How do you call an AIF web service from C#?

(0) ShareShare
ReportReport
Posted on by

Does anyone know of a simple tutorial that explains the basics of calling an AIF web service in AX 2009 from a C# application, or using a tool like SoapUI?

I have been trying to test the standard InventItemService just to get an idea how to set up the web services in general, but can't figure out how to call the 'read' operation, and I can't find much useful documentation online.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Florian DITTGEN Profile Picture
    15 on at
    Re: How do you call an AIF web service from C#?

    Hi David,

    perhaps this might help:

    floditt.blogspot.com/.../testing-aif-webservices-with-soapui.html

    Kind regards,

    Florian

  • Community Member Profile Picture
    on at
    Re: How do you call an AIF web service from C#?

    Thanks Amir,

    That looks like what I was after. None of the examples I could find had the CallContext part. I'll give that a try.

    I have just managed to get SoapUI to work anyway, after playing around with the proxy settings. Now I have a quick and easy way to test any AX web service.

    Regards,

    David

  • Verified answer
    Amir Nazim Profile Picture
    5,994 on at
    Re: How do you call an AIF web service from C#?

    Hi below sample code i used to test the read operation of the service, This sample code is for AX 2012 service, but i believe it should work for AX2009 as well

            private void ReadMethod()
            {
              AdvancedLedgerEntryServiceClient client;
              AxdAdvancedLedgerEntry axdAdvancedLedgerEntry;
              EntityKey[] ek;
              CallContext callContext;

                client = new AdvancedLedgerEntryServiceClient();
                axdAdvancedLedgerEntry = new AxdAdvancedLedgerEntry();
                callContext = new CallContext();

                ek = new EntityKey[1];
                ek[0] = new EntityKey();
                ek[0].KeyData = new KeyField[1];
                ek[0].KeyData[0] = new KeyField();
                ek[0].KeyData[0].Field = "TransactionNumber";
                ek[0].KeyData[0].Value = "DAT-000003";

                try
                {
                    axdAdvancedLedgerEntry = client.read(callContext, ek);
                    MessageBox.Show("done");
                }
                catch (Exception ex) { MessageBox.Show(ex.ToString()); }

                // if you want to show the output on grid
                dataGridView1.DataSource = axdAdvancedLedgerEntry.AdvLedgerEntryHeader;
                dataGridView1.DataMember = "AdvLedgerEntryHeader";
               
            }

  • Community Member Profile Picture
    on at
    Re: How do you call an AIF web service from C#?

    Thanks Kent, but I have already found that article. It seems fairly complicated to do a simple thing like call the 'read' operation of a basic web service. I will persevere with modifying that code to suit my purposes, but I'm not too familiar with C#, so it's a bit confusing. It's a shame they haven't included a step-by-step guideline on how to do it. I find the Microsoft documentation to be pretty vague and not very helpful.

    I have tried using SoapUI to test some AX web services, but SoapUI doesn't currently support the authentication required by AIF, so you have to use a proxy, but I haven't managed to get that to work either. Ideally I'd like to be able to use SoapUI or a similar tool as it's much easier and quicker to test your web services than having to write C# code.

  • Community Member Profile Picture
    on at
    Re: How do you call an AIF web service from C#?

    msdn.microsoft.com/.../cc652581.aspx

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans