Microsoft Dynamics AX 2012 – Introduction to AIF services
In many business scenarios, external software applications require access to information that is stored in Microsoft Dynamics AX. Below figure shows a few scenarios in which users access information that is managed in Microsoft Dynamics AX to accomplish a business task. It also shows sample scenarios in which Microsoft Dynamics AX accesses information that is managed in external applications.
The arrows indicate the direction in which requests flow.
What you can do with AIF services
Encapsulate Business Logic
With the Microsoft Dynamics AX services framework, you can encapsulate business logic—for example, functionality to create sales orders in Microsoft Dynamics AX—in Microsoft Dynamics AX services. You can then publish these services through the Application Integration Framework (AIF). These Microsoft Dynamics AX services can participate in a service-oriented architecture (SOA).
Communicate with External business processes
Microsoft Dynamics AX Application Integration Framework (AIF) enables companies to integrate and communicate with external business processes and partners through the exchange of XML over various transport media.
AIF enables both business-to-business and application-to-application integration scenarios.
AIF – Documents and Modes
Application Integration Framework (AIF) provides this capability by enabling the exchange of data through formatted XML. This formatted XML is referred to as a document, and each document contains data and business logic. Documents are based on a document class and defined by using Microsoft Dynamics AX.
The framework supports both synchronous and asynchronous transports.
In synchronous mode, requests are tightly coupled to responses. This means that the submitter of the request must wait for a response from AIF before proceeding. In this case, AIF immediately processes the request and then sends a response.
In asynchronous mode, requests are placed into a queue, called the gateway queue. Queued messages are processed at a later time and AIF sends a response when processing is completed. In this case, responses are delayed, but large volumes of messages can be processed more efficiently, and message processing can be controlled by changing various configuration settings.
AIF can be used to send data into Microsoft Dynamics AX. This kind of exchange is called an inbound exchange. AIF can also be used to retrieve data from Microsoft Dynamics AX. This kind of exchange is called an outbound exchange.
The AOS serves as the WCF (Windows Communication Foundation) service host for the MS Dynamics AX services that are exposed to the external applications.
Host and Consume Services
To consume services over the Internet, you must host services on Internet Information Services (IIS). Services that are hosted on IIS use the WCF message routing service. IIS routes all service requests to AOS.
IIS services are hosted without .NET Business Connector
IIS-hosted services use Windows Communication Framework routing service instead of .NET business connector. In the previous versions, the services that were hosted on IIS required .NET Business connector to communicate with AOS (Application Object Server).
Types of Services
Document services are query-based services that can be used to exchange data with external systems by sending and receiving XML documents.
Document services are used for implementing services that publish standard operations that operate on queries or tables, such as create, read, update, and delete; that is the CRUD operations.
Custom services can be used by Dynamics AX developers to expose any X++ logic, such as X++ classes and their members, through a service interface. To expose an X++ method as a custom service, there are two artifacts that are to be made; Service implementation class and service contract.
System services are provided by Microsoft Dynamics AX. System services include the Query service, the Metadata service, and the User Session service. System services are not customizable, and they are not mapped to any query or X++ code.
A service operation is a named set of functionality that is offered by a service.
A service group is a collection of services that are frequently consumed and managed together.
- All the services in a service group are published in a single WSDL file
- Publishing to a single WSDL file simplifies how developers consume services in their code
- A developer can create a service group in the Application Object Tree (AOT)
- Service groups are associated only with basic inbound integration ports.
In Microsoft Dynamics AX 2012, integration ports provide simplified administration of services and Application Integration Framework (AIF). Each integration port can expose one or more services, and each integration port has a unique Uniform Resource Identifier (URI) that identifies the address of the port. Each integration port also has a direction. An integration port can be either an inbound integration port or an outbound integration port.
Integration ports use adapters. These adapters enable Microsoft Dynamics AX to communicate by using various transport protocols.
A message corresponds to a WCF message. A message is a self-contained unit of data that can consist of several parts. These parts include a body and headers. When AIF receives and processes an inbound message, it generates an outbound message in response.