Ax 2012 AIF Calling the CustCustomerService.Create method from WCF

The CustCustomerService (External name CustomerService) can be used to create a customer in Ax through AIF.
When using the http adapter and consuming this service in a .Net Application, this is a tried and tested way to do it.
Notice the DirPartyTable assignment in the code. You do not need to specify the DirParty member, but that is where the customer name is held in Ax 2012

static void WebServiceTest()
    using (Ax2012WebService.CustomerServiceClient custClient = new Ax2012WebService.CustomerServiceClient())
        var context = new Ax2012WebService.CallContext() { Company = "ceu" };
        var customers = new Ax2012WebService.AxdCustomer
                CustTable = new Ax2012WebService.AxdEntity_CustTable[] 
                        new Ax2012WebService.AxdEntity_CustTable() 
                            DirParty = new Ax2012WebService.AxdEntity_DirParty_DirPartyTable[1] 
                                new Ax2012WebService.AxdEntity_DirParty_DirOrganization() 
                                    { LanguageId = "en-us", Name = "SS 001" }

6 thoughts on “Ax 2012 AIF Calling the CustCustomerService.Create method from WCF

  1. Thanks for the article.

    Do you know how to add an address to an existing customer?
    Do you know how to update an existing address?, while trying to do this I always get Invalid Entity Action or Entity action cannot be specified.

    Thanks again!


    1. Hi John, You can use AIF to read from a file. The File is an XML file with a specific schema. The batch job can periodically look at the nominated folder and process the files. However, if you are looking for calling the web service using another Non .Net application, then i wouldn’t recommend it, as you will require to hand code a lot of the XML. There are numerous blogs about that, I even wrote one about Androids and WCF talking to Ax.


Leave a Reply / Comment

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s