There has been little documentation, if any, either on MSDN or CustomerSource regarding the implementation of AIF Services with the BizTalk Adapter.
I have been working with this for Dynamics 2009, which is even worse, as all of the documentation is for dynamics 4. I managed to figure out, with the help of some others how to configure dynamics to enable BizTalk to at least send a document to it. It's all about end points, and services. See below for the step by step.
I must give credit to Dave Bowles a fellow Microsoft MVP. His blog post for the file adapter helped with the BizTalk adapter. This here helped for the file adapter as much of the setup is the same. It’s just nicer and actually easier with the BizTalk adapter.
I will be posting more on the specifics of BizTalk soon.. This is a whole lot of not documented stuff for Dynamics 2009.
Configuring Dynamics 2009 AIF for BizTalk 2006.
Pre setup still applies, for setting up the adapter and its end points, and users, as per what is documented. Then you do this which is not documented. All of this occurs inside of DYNAMICS.
1. You must setup the local endpoint for your organization.
IMPORTANT: You need to be selected into the company you are creating the end point for.
EACH organization needs this set up, to ensure that postings go to that organizations accounts. Local endpoints are created from your companies in AX. If you are only wanting to exchange documents with one of your companies within AX then you only need to create a local endpoint from that company. The local endpoint can be created by going into the Basic -> Setup -> Application Integration Framework -> Local Endpoints menu. Add a new record and select the company and create a name for that local endpoint.
2. Create the channels that you will be using. Channels link the BizTalk Adapter to which direction documents will be flowing and from/to which folder the documents will go/arrive. Open the Basic -> Setup -> Application Integration Framework -> Channels menu. Create a new record and set the Channel ID and Channel Name. The Channel ID will be the referenced name when you select a channel linking the Endpoints to the channel. More on Endpoints to come soon... Set the adapter for the new record, which should be ‘BizTalk GL Adapter’ and also set the direction.
The direction can be only be both, as it will handle receipt and sending of data from Dynamics. You only need to do this once.
3.) The next stop on our agenda will be the Actions menu again (if you went to it previously from our discussion in this article). Actions is located in Basic -> Setup -> Application Integration Framework -> Actions. For each Action that you would like to use, check the ‘Active’ field after all Actions have been registered. These are the schemas you send to AX.
4.) The MAJOR step in our setting up AIF within AX is to create Endpoints. Endpoints are the entities (or Trading Partners) with which you will exchange documents.
IMPORTANT: You need to be selected into the company you are creating the end point for, and the same company you created the local end point for.
You can reach the Endpoints menu by going to Basic -> Setup -> Application Integration Framework -> Endpoints. Create a new record and enter an Endpoint ID. This should be descriptive as to who the entity/Trading Partners since it will be what you select for some of the forms that require you to manually select an endpoint. Next, you will create a name for the endpoint and also choose the local endpoint that will be communicating with the entity/trading partner. If you have multiple companies in AX and each company will be exchanging documents with this particular Endpoint, then you will need to have one Local Endpoint for each company and AX, plus multiple Endpoints setup for the same entity/Trading Partner to join to each individual Local Endpoint.
The Endpoint to Local Endpoint relation is one-to-one. The next step to configuring the Endpoint is to go to the Constraints tab and either select ‘No Constraints’ or add as many Constraint records as you wish. As I alluded to earlier, constraints may be created for customers, vendors, or warehouses. So far the only Action that requires constraints is the ‘readPickingList’ action. The next step is to configure the ‘Users’ tab. In the Users tab, you can set up one or multiple users (AD logins) or one or more groups (AX security groups). This is the security that is built into AX so that not just anyone can send/receive XML documents into/out of your system. You can also setup ‘Trusted Intermediaries’ which would be like another AD with which you would setup a ‘trust’ relationship.
This user, needs to be your gateway proxy user on the Adapter or Port BizTalk(Depending how you configured this), it needs to have permissions to perform your desired action in Dynamics.
Company name > Administration > Inquires > User Permissions > Select the user.
You can check this by clicking on the user, and select permissions tab
Finally the last major step in setting up the Endpoints is setting up the Action Policies associated with the Endpoints. This piece ties the Endpoint to the Actions that we viewed earlier. Click the ‘Action Policies’ button on the Endpoints form. Here we will create a new record and select an Action to tie to the Endpoint. (Note: only actions that you have activated will appear in the list. If you want to see all actions appear, then you will need to go back to the Actions menu and Activate all Actions.) After selecting an Action, set the status to ‘Enabled’ and set the logging mode to your preference. I use the ‘Log All’ mode in order to get all information about problems with AIF transactions.
Once you have filled out the record, click the ‘Save’ button on the toolbar to save the record and you will see the ‘Data Policies’ button highlight on the Action Policies form. Click the ‘Data Policies’ button and you will see all of the XPath elements that will be included in the XML document for this particular action. In order to allow all elements to be displayed, click the ‘Set’ button and select ‘Enable All’. The final step will be to exit out of the Data Policies Form, and then out of the Action Policies form, and when you are back in the Endpoints form, select the ‘Active’ checkbox on the General tab in order to activate the Endpoint.
5.) If you are receiving XML documents inbound into AIF, there are a couple of things that must happen to the documents before AIF will accept them. First, at least one of the person(s) or members of group(s) that are listed under the User tab in the Endpoint menu must be the owner of the inbound XML document.
AIF will not process a document if the owner of the document is not affiliated with the ‘Users’ tab in Endpoints. Within the XML document being sent inbound, there is an area in the XML header that allows you to set the MessageID, SourceEndpointUser, SourceEndpoint, and DestinationEndpoint. The MessageID must be a unique GUID, the SourceEndpointUser must be set to same user that is the owner of the inbound XML document in the format of ‘DOMAIN\USERNAME’, the SourceEndpoint must be the Endpoint ID from the Endpoint menu who sent you the XML document, and the DestinationEndpoint must be set to the Local Endpoint ID which will be the company in AX that should be receiving the XML file that you defined earlier in the article in Local Endpoints.
This user needs to be set up, and placed in the xml, this user needs to be the same user you specified who could run the action in step 4. This user is typically your gateway user as well, so it all ties up, however it can be different.