Вы находитесь на странице: 1из 5

4/11/2015

DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

Shashi's Ax.Net Space


An Ax / .Net and other technologies blog

Dynamics Ax 2012 AIF Import CSV File


Part 1: Consume Webservice
April 11, 2011

.Net, Ax 2012, Dynamics Ax, WCF


1 Vote

AIF, AX2012, Dynamics Ax

I will start a series for AIF 2012 to use the Inbound port file adapter settings structured:
Part 1: Consume Web Service
Part 2: Create Item from File adapter
Part 3: Import CSV file with items Through AIF
The aim is to start from a web service to consume an AIF service, and then move that to a file system
adapter. I will that take that a step further by adding a .Net transformation library so that we can import
a CSV file to do the same. Allthroughoutthe process, there will be no change done within Dynamics Ax
itself.
The service I am going to consumethroughoutthe series is the InventItemService, and i will create an
item.
With AX2012, we need to create a product and then release it. So for this demonstration, I will assume
that the Products have been created, but have not been released yet.The AIF webservice
InventItemService.create will do this for us.

Create and Consume web service:


I have found consuming AIF as web services easier than File adapter, which is why I start with this and
then move this over to the File adapter.
Setting the AIF HTTP port to expose the InventItemService.Create:

https://shashidotnet.wordpress.com/2011/04/11/dynamicsax2012aifimportcsvfilepart1consumewebservice/

1/5

4/11/2015

DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

Add InventItemService.create to the port


Once the Inbound port is activated, we can consume this in Visual studio. I shall create a Console
application, and hard code the items to be created.
In Visual studio, add the service reference using the URI field of the Inbound Port.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

staticvoidMain(string[]args)
{
//InitialisetheService
using(LoonItemService.ItemServiceClientclient=newLoonItemService.ItemServiceClient()
{
//Initizliseparametersusedforthecreatemethod
LoonItemService.CallContextcallContext=newLoonItemService.CallContext(){Company
LoonItemService.AxdItemaxdItem=newLoonItemService.AxdItem();

LoonItemService.AxdEntity_InventTableinventTable=newLoonItemService.AxdEntity_Inv
inventTable.ItemId="SS001";
inventTable.NameAlias="SS001NAMEAlias";
inventTable.Product="SS001";

ListlstInventTable=newList();
lstInventTable.Add(inventTable);
axdItem.InventTable=lstInventTable.ToArray();

//CalltheAIFcreatemethod
varresult=client.create(callContext,axdItem);

//Displaytheresult
foreach(variteminresult)
{
foreach(vardatainitem.KeyData)
{
Console.WriteLine(string.Format("{0}:{1}",data.Field,data.Value));
}
}
}
}

https://shashidotnet.wordpress.com/2011/04/11/dynamicsax2012aifimportcsvfilepart1consumewebservice/

2/5

4/11/2015

DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

For a more detailed process on how to use the inventItemService.create look at this link: How to create
an item using ItemServices and EcoResProductServices in AX 2012
On Running the code above, the Item is displayed in the Console, and if you check AX, the item SS001 is
now a part of the Released products.

Item SS001 added to the released products


This is what we will replicate across to the File System adapter. in Part 2 and 3
About these ads

Share this:

Like
Bethefirsttolikethis.

Related

Dynamics Ax 2012 AIF


Import CSV File Part 3:
Import CSV file using AIF
In ".Net"

Dynamics Ax 2012 - AIF


Import CSV File - Part 2:
Create Item from File
adapter
In "AIF"

Android Ax App Part 2


The Android app
In "Android"

https://shashidotnet.wordpress.com/2011/04/11/dynamicsax2012aifimportcsvfilepart1consumewebservice/

3/5

4/11/2015

DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

10 thoughts on Dynamics Ax 2012 AIF Import CSV


File Part 1: Consume Webservice

Pingback: Dynamics Ax 2012 AIF Import CSV File Part 2: Create Item from File adapter Shashi's
Ax.Net Space

Pingback: Dynamics Ax 2012 AIF Import CSV File Part 3: Import CSV file using AIF Shashi's Ax.Net
Space

Pingback: Import CSV files using AIF - Palle Agermark on AX - AX Technical Blogs - Microsoft Dynamics
Community

Pingback: Import CSV files using AIF | UnitedTechnos

Pingback: Ebbes Nrderi (Ebbes Nerdery) Blog Archive Import using AIF

Pingback: Dynamics Ax 2012 AIF Import CSV File 38

Pingback: Dynamics Ax 2012 AIF Import CSV File - Mukesh Hirwani - Microsoft Dynamics AX - AX
Technical Blogs - Microsoft Dynamics Community

Pingback: Dynamics Ax 2012 AIF Import CSV File Part 3: Import CSV file using AIF - Shashis Microsoft
Dynamics Ax Blog - AX Technical Blogs - Microsoft Dynamics Community
https://shashidotnet.wordpress.com/2011/04/11/dynamicsax2012aifimportcsvfilepart1consumewebservice/

4/5

4/11/2015

DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

Pingback: Dynamics Ax 2012 AIF Import CSV File Part 2: Create Item from File adapter - Shashis
Microsoft Dynamics Ax Blog - AX Technical Blogs - Microsoft Dynamics Community

Pingback: Transform AIF output to a CSV file - Microsoft Dynamics AX Community

https://shashidotnet.wordpress.com/2011/04/11/dynamicsax2012aifimportcsvfilepart1consumewebservice/

5/5

Вам также может понравиться