Home > Dynamics Ax > Dynamics Ax – AIF-Web Service

Dynamics Ax – AIF-Web Service


Creating and Consuming AIF Web Services

Pre-Setup
·         AOS, Client and BC.Net are installed
·         IIS is installed
·         ASP.NET 2.0 is enabled

Setup

·         Install AIF Web Services (Use All Defaults)
·         Open the AX Client
·         Add  a local end point

Basic -> Setup -> Application Integration Framework -> Local endpoints

Set Company as DAT and Local endpoint as localEndPoint

·         Add a web site

Basic -> Setup -> Application Integration Framework -> Web sites

Set the Name (Example: MicrosoftDynamicsAx) and Virtual directory share path to \%MACHINENAME%VirtualDirectory <file://%25machinename%25/VirtualDirectory>  Name (Example: \paruvellaMicrosoftDynamicsAXAif50 <file://paruvella/MicrosoftDynamicsAXAif50> )

·         Generate the Service

Basic -> Setup -> Application Integration Framework -> Services

Select a service (Example: VendVendGroupService), click Enabled box, save and then click Generate button

Now I have the service generated (Example: http://paruvella/MicrosoftDynamicsAXAif50/VendGroup.svc)

 Consuming the Service with example code

·         Create a client in VS (Example: a console app named TestClient)

·         Add the service reference previously created, Optional: enter a namespace name (Example: VendGroupService)

·         Add the reference to System.ServiceModel. This will generate the proxy for VendGroup service

·         Added the following code in the Program.cs file

 C# Code :

namespace TestVendGroup
{
    class TstFIMVendGrp_ReadVendGroup
    {
        static void Main(string[] args)
        {
            VendGroupServiceClient proxy = new VendGroupServiceClient();
            AxdVendGroup vendGroup;
            EntityKey[] entityKeyList;
            EntityKey entityKey = new EntityKey();
            KeyField keyField = new KeyField();

            keyField.Field = "vendGroup";
            keyField.Value = "DOM";
            entityKey.KeyData = new KeyField[1] { keyField };
            entityKeyList = new EntityKey[1] { entityKey };         
            vendGroup = proxy.read(entityKeyList);     
            Console.Write(vendGroup.VendGroup[0].Name);
            Console.ReadLine();
        }
    }
}  

I started the writting blogs writting from today onwards.  Smile.

I will update my blog with more AIF related stuff. I am very much interest towards the AIF concepts. Red heart.

Advertisements
Categories: Dynamics Ax
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: