Dynamics AX 2009 - AIF - Adapter Based Exchange - File System - Inward Data Configuration Help Needed

Question Status

Deva asked a question on 6 Apr 2009 10:08 PM

Dear Experts

I am working on Dynamics AX 2009 AIF - Adapter Based Exchange - File System based trying to push Item details through an XML file. I could sucessfully export the data from the AX 2009 through AIF, whereas I couldnt import them inside the system - the batchfiles are bringing the data from the folder into the Axapta Queue and from there it is not getting pushed into the tables - I have called the two services - AIFGatewayReceiveService and AIFInboundProcessingService through batch.

Here is the configuration which I made:

 1. Created Local Endpoint - default to company            Company - DAT            Local endpoint - Local1DAT2.Transport Adapters            Adapter Class - AifFileSystemAdapter            Name - File System Adapter            Active - Yes            Direction - Receive Or Send3.Channels            Channel ID - CHN003            Name - File System Channel            Active - Yes            Adapter - File System Adapter            Direction - Outbound            Parallel Processing - No            Address - F:\Test Folder\            Response Channel -             Channel ID - CHN004            Name - File System Channel            Active - Yes            Adapter - File System Adapter            Direction - Inbound            Parallel Processing - Yes            Address - F:\Test Folder 1\            Response Channel - CHN0034. Endpoints            Endpoint ID - Inbound-Item            Name - Item Inbound            Active - Yes            Propogate Errors - Yes            Intercompany Organization - No            Outbound channel ID - CHN003            Local endpointID - Local1Dat                        No Contraints            Users - User group - Admin - Administrators             Action Policies for this Endpoint            Action ID - InventItemService.create            Is default policy - No            Status - Enabled            External identifier override            Class Name - InventItemService            Logging mode - Log Original       {Datapolicy - required all enabled fields} 

<<<<<<<<<<<<XML FILE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  <?xml version="1.0" encoding="UTF-8" ?>
- <Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
- <Header>
- <Body>
- <MessageParts xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
- <Item xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Item">
- <InventTable class="entity">
- <Sales class="entity">
- <Purch class="entity">
- <Invent class="entity">
- <InventItemLocation class="entity">
- <InventItemSalesSetup class="entity">
- <InventItemPurchSetup class="entity">
- <InventItemInventSetup class="entity">
Kindly correct if my above configuration setup is wrong. Thanks in advance.
Santosh Ramamurthy responded on 8 Sep 2009 1:00 AM


The encoding format is generally decided based on the Global setting in Application Integration Framework

(Basic > AIF > Global Settings)

One more issue you had regarding the following error

Warning: Field 'Item number' must be filled in. in subsystem  Subsystem: Line=1, Pos=77, Xpath=/Item/InventTable[1]

Error: Error found when validating record. in subsystem Subsystem: Line=1, Pos=77, Xpath=/Item/InventTable[1]

This is b'coz the xML doesn't have these information filled in. So make sure you update the xML with the following entity or disable the parameter from the data policy form which can be done through (Basic > AIF > Endpoints > Action policies > Data policies)

Richa Mohadkar responded on 6 Oct 2009 6:42 AM

Hi all,


I am getting error while importing XML from Inbound folder to AX 2009. I want to see XML data in Form , but I am not able to see it in COA form. Batch job is running after every 1 min , and XML is getting consumed by AX. Below exceptions we are getting SubSystemName : AifGatewayQueueCannot create a record in Gateway Queue (AifGatewayQueue). Message ID: {1652FD2C-C3D4-4B90-9815-369BAF917D98}, In Transport Process.The record already exists. SubSystemName : AifRequestProcessor-processServiceRequest. User is not authorized for this Endpoint. 

Business connector proxy having admin credentials


XML as follow


<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

- <Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
- <Header>
  <SourceEndpoint />
  <DestinationEndpoint />
- <Body>
- <MessageParts>
- <ChartOfAccounts xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/ChartOfAccounts">
- <LedgerTable class="entity">
  <AccountPlType />
  <AutoAllocate />
  <BlockedInJournal />
  <BoldTypeface />
  <Closed />
  <ConversionPrinciple />
  <DebCredBalanceDemand />
  <DebCredCheck />
  <DebCredProposal />
- <Dimension>
  <element />
  <element />
  <element />
  <element />
  <element />
  <element />
  <element />
  <ExchAdjusted />
  <Italic />
  <LedgerClosing />
  <LineExceed />
  <LineSub />
  <MandatoryCurrency />
  <MandatoryPaymReference />
  <MandatoryPosting />
  <MandatoryTaxCode />
  <MandatoryUser />
  <Monetary />
  <Posting />
  <RecId />
  <RecVersion />
  <ReverseSign />
  <TaxDirection />
  <TaxFree />
  <TotalByPeriod_FR />
  <UnderlineNumerals />
  <UnderLineTxt />
Santosh Ramamurthy responded on 6 Oct 2009 9:56 PM

Hi Richa,

 The error which you observe is because of the following reason.

1) Message ID: {1652FD2C-C3D4-4B90-9815-369BAF917D98}, In Transport Process.The record already exists.
Because the same Message Id exists in the xML due to which it throws error stating "Cannot create a record in Gateway Queue (AifGatewayQueue)." So the solution is when xML is placed in the xML folder please update the MessageId. Change any two character in the message Id and this error will not be populated again.

2) SubSystemName : AifRequestProcessor-processServiceRequest. User is not authorized for this Endpoint. 
In the xML THERE is an entity tag missing
You need to pass the user credentials for the Xml to process AIF xml when consuming.

Hope this solution was useful to you. Please revert back in case of any issue.


Richa Mohadkar responded on 8 Oct 2009 10:08 PM

Thanks Satosh for reply.

I am able to import XML in to AX 2009.

i have query for importing 1 XML which contain data nodes for 2 tables that should be get imported into  VENDTABLE and VENDBANKACCOUNT . Is there any configuration we need to do for  parent and child relation table.


Thanks & Regards,



Santosh Ramamurthy responded on 8 Oct 2009 11:58 PM


 Well if you have a AxD query then you should be able to import the xML. As such we dont need any configuration to be setup.

 The think your query will be like this

VendTable -------> VendBankAccount

Relation being between both these tables are "VendAccount" and Fetch Mode is 1:n, Join Mode: Inner Join

Accordingly you will have a AxD class where you need to handle the scenario.

1) If vendAccount, VendBankAccount exist insert into relating table else throw error




Richa Mohadkar responded on 9 Oct 2009 12:45 AM

Hi Santosh,  

How we can create AXD classes which will states relationship between Vendtable and VendBankAccount (VendAccount) ?

then do we need to create service class for this?


Thanks & Regards,



Santosh Ramamurthy responded on 9 Oct 2009 2:20 AM


The basic prerequisite is to create a AxD query under AOT\Queries node. You need to define your relationship(JoinMode, FetchMode) in the Query based on the Business needs. Then you need to run the Application Integration Framework (Tools> Development Tools > Application Integration Framework > Create Document service).

It will create AxD(Ax Document class) and AxBC (Ax business class) along with the services(which can be viewed under AOT\Services)

To write create functionality you need to write the business logic under Ax<Table name> Class(AxD) in PrepareForSave method.

There is no need for you to create service class and this gets generated through the AIF wizard.


Nicole Cheah responded on 15 Jul 2010 3:09 AM

Hi Deva,

I still facing such issues even though i'm applying your method, but it still not working... Do you have any idea? Mine one is using MSMQ. Kindly advise. Thanks 


Ray DAX responded on 20 Dec 2010 1:50 PM

Hello Santosh,

I am trying to do an AIF inbound transfer using file system adapters. I have an XML file in a windows folder that is given complete share and access permissions and is assigned as the Inbound channel.

I created batch jobs having tasks that run AifGatewayReceiveService and AifInboundProcessingService.

In case of endpoints, instead of using default endpoints, I have created another endpoint and gave the corresponding local endpoint (the local endpoint pertains to the current company)

All other configurations(channels, actions, services are set). Also, i know that the service is running successfully, as I am able to create production orders in AX by using the same AIF document service as a web service in .NET.

But here, with the file system adapters, the bacth job is not doing anything. i do not even see errors or exceptions in the AIF section. nothing in the queue manager either.

Is the problem with my XML message or with the way the endpoints are configured?  Would there usually be any issues if we do not use the default endpoint and create one of your own?

Thanks in advance



NJK responded on 20 Dec 2010 8:54 PM

Hey Ray,

I'm not sure why this is happening to you. But lets first try to do basic troubleshooting steps.

1) I hope the XML file is available in windows folder with complete share and access permissions and is assigned as the Inbound channel. If so then write the following code in the Jobs path and run it and check if the xML is picked?

void AIFInboundJob()

    new AifGatewayReceiveService().run();
    new AifInboundProcessingService().run();

Even after executing the job if the xML is still available in the folder. Check for AifResourceLock table and see if this record has some lock. In case if its then pls delete it and try executing the Inbound job.

I hope this should solve your issue. In case if your still facing the issue please revert back to me to all the details. Alternatively you can allow refer few articles on AIF in my blog.

http://sangi1983.spaces.live.com  (The above site will be redirected to my Word press blog)

Nabeel Khan responded on 29 Aug 2011 8:19 AM

hi deva, one things i want to know. why did you not use the Default Endpoint provided by Dynamics AX, and created your own.