I have had two recent projects which required me to call on Dynamics AX AIF operations from BizTalk, one of them being a BizTalk 2009 project, and another being a BizTalk 2010 project which required me to install the Dynamics adapters as well since it was a relatively new environment.  After this experience, I can only say that I am so glad that Microsoft have decided to streamline the way AX integrates with the rest of the enterprise from Dynamics AX 2012 onwards and is depending on WCF rather than a proprietary means of communication, see http://technet.microsoft.com/en-us/library/hh352300.aspx.  For now though you will need to wrap your head around AIF (Application Integration Framework).

I highly recommend that you read Microsoft White Paper on integrating Dynamics AX 2009 with BizTalk to find out what AIF is all about – http://www.microsoft.com/download/en/details.aspx?id=17539.  That said, I will try to make your life a bit easier by giving you a head start in these blog posts, since it’s a lot quicker to read than a full white paper.

In this blog post, I will give you an overview of how to install the adapters for Dynamics AX 2009 in your BizTalk environment, and how to setup AX (please note that I am by no means an AX expert, but I will try my best) such that the specific AIF you are after is exposed to BizTalk.  In the second part of this post which I intend to publish towards the end of this week, I will walk you through calling on a simple AIF service which we will have already exposed in part 1.  I believe these posts should be applicable for BizTalk 2009 and BizTalk 2010, I’m not sure whether there would be any differences with prior versions.

First things first, you need to get a copy of the AX installer and run it on your BizTalk server(s).  Accept the terms and conditions, and choose to perform a custom installation.  Choose the BizTalk adapter (which will automatically select the .NET business connector as well) and hit next.

Choose to install the prerequisite software if required.

Next up we need to set up the connection information to the AX Server.  Put in the server name under the AOS name.  You should be able to leave the port at the default 2712 unless you are running multiple AOS instances (which probably implies you’re running multiple AX environments) in which case it might be 2713 or higher, you would need to check this with your AX administrator.

Beyond that, you should just be able to breeze through the rest of the installation by choosing next and install.

If you take a look in the Platform Settings -> Adapters section of the BizTalk Server Administration Console, you will now see the Dynamics AX 2009 adapter.  Woohoo 🙂  You might want to make sure that you are happy that the default send and receive handlers are against the appropriate host instances.  If you’re not happy with the default choices then you should make the appropriate changes.

Next up, we need to configure Dynamics AX to allow communication from our BizTalk server.  You will need administrator access in Dynamics to do the below, if you don’t have the required access levels then go grab your administrator and prepare to be a backseat driver.  Open up Dynamics AX, and you want to select the basic view from the bottom left of your screen (I’m not sure if Dynamics AX looks the same in all deployments, but here is a partial screenshot of how I enter the basic menu).

We are now interested in the options listed under Application Integration Framework over on the right hand side of the screen (see above screenshot).

Lets start by looking at the Local Endpoint.  What you want to see here is a record with your company code.  If there isn’t one already then click the new button (the top left button in this sub window), choose your company code using the drop down selector, and type in a name for your Local Endpoint.  You will want to remember this name.

Next up, you will want to visit the transport adapters section. You want to ensure that there is a record with the Adapter Class AifBizTalkAdapter.  If there isn’t one then create a new record and choose the AifBizTalkAdapter from the drop down selection.  You will want to mark the record as active and to set the direction to Receive and Response.  You can choose a name for this Adapter entry as well.

Next, you will want to visit channels.  You’ll want to configure it such that you have an entry like the one in the screenshot below.  The address field doesn’t really matter, you can put any value in here (this had me worried for awhile but Microsoft’s white paper confirms this).

While you’re still on the channels page, you’ll want to highlight your BizTalk channel record and choose configure on the right hand side of the screen.  You now need to enter the names of the BizTalk servers that will be communicating with Dynamics AX.

The next step is to select which services should be enabled.  For the rest of this post, let us assume that you are interested in the Find method on the CustCustomerService service.  Every out of the box service supports one or more generic methods, these methods being find, findkeys, read, update, create, delete (pretty self explanatory).  These services typically represent a table in the Dynamics AX database, I believe this service represents the CustTable table.  Click on the services option and ensure that the CustCustomerService record is enabled.

Next up we want to look at Endpoints.  You will want to create a new endpoint, giving it an ID and a Name, and choosing the Local Endpoint ID that we created a few steps ago.  It should look like the below.  You will then want to navigate over to the users tab and add in your BizTalk Host Instance identity (your AX administrator will need to set up an AX ID that is linked to this username and then you can select it on this screen).

While still on the endpoints screen, and while focusing on your remote endpoint, you will now want to click the Action Policies button.  If CustCustomerService.find isn’t listed here then select the new button and choose it from the drop down menu in the action ID column.  Make sure the status is enabled.

Highlight CustCustomerService.find and click on data policies.  You should get a popup window which has a single record with a direction of outbound (I’ll explain why you only see outbound over here in the next blog post).  Choose it and click on data policies again.  What you’re presented with here is a list of all the data elements that could be included in the response message for this method.  You can either leave it as it is or choose which elements you want to enable.

That should be everything you need to know to expose the CustCustomerService.find to your BizTalk environment.  In part 2 I will cover how you will develop a BizTalk solution which calls on and consumes the response from this service.