AIF Service Common Usage Scenarios in ax 2012

25 May

Custom Services: Use to expose very simple business entities as a service, or to expose custom logic from Microsoft Dynamics AX.

This Service enables developers to expose any logic written in x++ through a service interface. The support for Custom Services was introduced in Dynamics AX 2009, but it was limited to some specific data types. In Microsoft Dynamics AX 2012 with the integration of Windows Communication Foundation (WCF), attributes can be set on the Data Contract class to make them serialize and De-serialize across the network connection.

  • To expose a custom x++ logic.
  • Say, you have a custom module and you want to expose some logic/code to your custom application.

Document Services: – Use to expose business entitles with varying degrees of complexity, or to support medium-to-complex integration scenario involving business entities.

This was introduced in Microsoft Dynamics AX 4.0. It enables the user to exchange data between internal and external systems via XML documents. Document Services are generated from a query that models the business entity. For example, a customer query will run the Document Service Generation Wizard to create the Service artifacts.

Document Services include logic to handle the details of how a query will be serialized or De-serialized from the XML that is sent across a network. For synchronization of Document Services, there are two new entities introduced in Dynamics AX.

  • getKey
  • getChangedKey

Developers need to extend these functions to enable their own scenario.

  • Document services are services which expose a business entity. For example, Customer, Vendor, Employee, Sales Order.
  • You can Map the business entity using Query and run through Document Service Wizard to build the web service and perform CRUD operations.

System Service: System services are Windows Communication Foundation (WCF) services that are included with Microsoft Dynamics AX. These services enable clients to interact with and retrieve system information.

This is a new Service category introduced in Microsoft Dynamics AX 2012. This type of Service is not customizable and not mapped to any X++ code. There are three types of Services that come under System Services:

  • Query Service
  • Metadata Service
  • User Session Service

All these Services have unique functionality that will be discussed in my next post.

  • System services are kind of utility services.
  • Up and running when AOS starts.
  • Can be used for interactive clients
  • Build Ad-hoc query

System Service: Query Service: – Use to implement read operations for any Microsoft Dynamics AX, ad-hoc, or existing AOT query.

  • Enables you to issue a query for data without using an Application Integration Framework (AIF) document service or creating a custom service. The query service returns data in a dataset and implements a paging mechanism so that you can manage queries that return large amounts of data.

When you call the query service, you can specify the query to run in one of three different ways:

    • Static query – A query that is already defined in the AOT under the Queries node.
    • User-defined query – A query that is defined by using the QueryMetadata class which is found in the metadata service.
    • Dynamic query – A query that is defined in an X++ class that extends the AifQueryBuilder class. All query logic resides in the query builder class

System Service: Metadata Service: – Use to retrieve information about the structures in Microsoft Dynamics AX for a client application. For example, if you want to return information about a table such as what indexes exist on that table, you can use the metadata service.

Enables you to retrieve information about elements in the AOT. You can retrieve metadata for labels, menus, menu items, tables, extended data types, data types, enums, queries, web menus, web menu items, info parts, cues, dimensions, form parts, web controls, service groups, and services. The metadata service should be used when you want to return information about the structures in Microsoft Dynamics AX to a client application. For example, if you want to return information about a table such as what indexes exist on that table, you can use the metadata service.

System Service: User Session Service: – Use to retrieve information about the user session.

Enables you to return information about the current Windows user. You can return information such as the user’s default language, Default Company, default company time zone, permissions to access-controlled items, and so on

Leave a comment

Posted by on May 25, 2015 in AIF



Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

Anitha Eswaran - Dynamics Ax

Microsoft Dynamics Ax blog


AxaptaHut ax = new AxaptaHut();

All About Dynamics 365

Dynamics 365, D365, Implementor

Syed Rafay Ali

This blog contains information about Functional techniques and guidelines in Microsoft Dynamics AX, including tips, tricks, tutorials, tools and upcoming news enhancement in Microsoft Dynamics Ax

Philippsen's Blog

Everyday findings in my world of .net and related stuff

Microsoft Dynamics AX

A great site


All things Blockchain, AI and IoT

Dynamics Ax

Technical Knowledge


A blog about implementing Microsoft Dynamics AX and Dynamics 365 for Operations

Microsoft Dynamics 365 Blog

Blog by Sandeep Chaudhury, A Microsoft Enthusiast

DEVSerra - Dynamics AX development blog

Your official Microsoft Dynamics AX blog.


Discovering Dynamics


A blog by Hai Nguyen

Learn Dynamics Ax with Johnkrish

Live as if you were to die tomorrow. Learn as if you were to live forever - Mahatma Gandhi ****** The more I learn, the less I know - Albert Einstein

Twisted Untwirled

Just another site


Just another site

%d bloggers like this: