5
Shashi's Ax.Net Space An Ax / .Net and other technologies blog 1 Vote Dynamics Ax 2012 – AIF Import CSV File – Part 1: Consume Web service April 11, 2011 .Net, Ax 2012, Dynamics Ax, WCF 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. All throughout the process, there will be no change done within Dynamics Ax itself. The service I am going to consume throughout the 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:

Dynamics Ax 2012 – AIF Import CSV File – Part 1_ Consume Web Service _ Shashi's Ax

Embed Size (px)

DESCRIPTION

Dynamics Ax 2012 – AIF Import CSV File – Part 1_ Consume Web Service _ Shashi's Ax

Citation preview

  • 4/11/2015 DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

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

    Shashi's Ax.Net SpaceAn Ax / .Net and other technologies blog

    1 Vote

    Dynamics Ax 2012 AIF Import CSV File Part 1: Consume WebserviceApril 11, 2011 .Net, Ax 2012, Dynamics Ax, WCF 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 ServicePart 2: Create Item from File adapterPart 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 systemadapter. I will that take that a step further by adding a .Net transformation library so that we can importa CSV file to do the same. Allthroughoutthe process, there will be no change done within Dynamics Axitself.

    The service I am going to consumethroughoutthe series is the InventItemService, and i will create anitem.

    With AX2012, we need to create a product and then release it. So for this demonstration, I will assumethat the Products have been created, but have not been released yet.The AIF webserviceInventItemService.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 andthen move this over to the File adapter.

    Setting the AIF HTTP port to expose the InventItemService.Create:

  • 4/11/2015 DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

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

    Add InventItemService.create to the port

    Once the Inbound port is activated, we can consume this in Visual studio. I shall create a Consoleapplication, and hard code the items to be created.

    In Visual studio, add the service reference using the URI field of the Inbound Port.

    12345678910111213141516171819202122232425262728293031

    staticvoidMain(string[]args){//InitialisetheServiceusing(LoonItemService.ItemServiceClientclient=newLoonItemService.ItemServiceClient()){//InitizliseparametersusedforthecreatemethodLoonItemService.CallContextcallContext=newLoonItemService.CallContext(){Company=LoonItemService.AxdItemaxdItem=newLoonItemService.AxdItem();LoonItemService.AxdEntity_InventTableinventTable=newLoonItemService.AxdEntity_InventTable();inventTable.ItemId="SS001";inventTable.NameAlias="SS001NAMEAlias";inventTable.Product="SS001";ListlstInventTable=newList();lstInventTable.Add(inventTable);axdItem.InventTable=lstInventTable.ToArray();//CalltheAIFcreatemethodvarresult=client.create(callContext,axdItem);//Displaytheresultforeach(variteminresult){foreach(vardatainitem.KeyData){Console.WriteLine(string.Format("{0}:{1}",data.Field,data.Value));}}}}

  • 4/11/2015 DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

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

    For a more detailed process on how to use the inventItemService.create look at this link: How to createan item using ItemServices and EcoResProductServices in AX 2012On Running the code above, the Item is displayed in the Console, and if you check AX, the item SS001 isnow 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

    Share this:

    About these ads

    1

    Like

    Bethef irsttolikethis.

    Related

    Dynamics Ax 2012 AIFImport CSV File Part 3:Import CSV file using AIF

    Dynamics Ax 2012 - AIFImport CSV File - Part 2:Create Item from Fileadapter

    Android Ax App Part 2The Android app

    In ".Net"In "AIF"

    In "Android"

  • 4/11/2015 DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

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

    10 thoughts on Dynamics Ax 2012 AIF Import CSVFile Part 1: Consume Webservice

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

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

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

    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 - AXTechnical Blogs - Microsoft Dynamics Community

    Pingback: Dynamics Ax 2012 AIF Import CSV File Part 3: Import CSV file using AIF - Shashis MicrosoftDynamics Ax Blog - AX Technical Blogs - Microsoft Dynamics Community

  • 4/11/2015 DynamicsAx2012AIFImportCSVFilePart1:ConsumeWebservice| Shashi'sAx.NetSpace

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

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

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