In this blog, I will illustrate the scenario that I faced recently. In this scenario, I got an opportunity to integrate Microsoft Dynamics AX 2012 R3 CU10 with a well-known construction application.

Summary about the Construction Application

This construction application is a real-time scheduling, collaboration, and supply chain management tool designed by builders, for builders. This construction application enables builders to manage each construction project with greater accuracy and efficiency and do so in less time and with less effort than ever before.

Requirements & Limitations

Some points to keep in mind about the construction application:

  • This construction application only understands messages in XML format to communicate with other systems. Please note that there is a specific XML format that the construction application understands.
  • This construction application needs to be able to send and receive a couple of different documents / messages to and from Microsoft Dynamics AX respectively. Please note that the documents / messages that we need to send and the documents / messages that we need to receive were different from each other.
  • All messages that the construction application need to receive requires some specific formatting based on the document.
  • In order to receive messages from AX, the construction application has a URL that can receive XML messages when posted. The URL was based on the format mentioned below:
  • In order to send messages to AX, the construction application requires a URL at which it can post XML messages.
  • AX and the construction application are on separate servers. So, the solution needs to incorporate communication over the internet (using public IP’s).

Proposed Solution

Based on above requirements and limitations, the solution I came up with is to integrate the construction application with Microsoft Dynamics AX 2012 R3 using Application Integration Framework (AIF) with some tweaks here and there.

  • Overview of Application Integration Framework (AIF)
    • There are 3 types of services supported by Application Integration Framework (AIF) in Microsoft Dynamics AX 2012.
      • Document services
      • Custom services
      • System services
    • I proposed the following steps to achieve desired integration results:
  • Inbound Communication (messages coming from the construction application to AX)
    • Create Custom Inbound services for all the messages coming from the construction application to AX.
    • These custom inbound services are responsible for reading the incoming XML file and performing appropriate actions in AX.
    • Write a middleware application that pass through all the incoming messages from the construction application to AX. For testing purpose, I created ASP.NET page and deployed it on the same server as AX. This ASP.NET web page receives XML messages from the construction application and passes it to AX by consuming inbound services.
    • Create enhanced inbound port and set adapter type as HTTP.
    • Configure Internet Information Services (IIS) to route incoming messages from the construction application to AX. (Please note IIS is required as both applications are separate servers and will communicate over the internet via Public IP’s.)
  •  Outbound Communication (messages going from AX to the construction application)
    • Create AIF custom document services for all the messages going from AX to the construction application. Please note that these services will generate XML messages based on the Standard AX AIF format.
    • Add logic to AIF Gateway queue for document specific formatting for outbound messages.
    • Add parameter to the outbound ports in order to control the document specific formatting.
    • Create custom adapter in order to post messages to the construction application URL.

By following above mentioned steps I achieved the results that are desired by the client.

Implementation of Inbound Communication

  • Overview of Custom Inbound Service:
    • An Inbound service is used when you want to send data to an external system. Custom Inbound services are mostly used when:
      • The complexity of the entities is relatively low.
      • When you want to have full control of the service contract.
      • When data contracts needs to be shared with different entities.
  • There are 3 important things to know about a Custom Inbound Service:
    • Service operation:
      • Service operations are class methods that expose any business logic in a service. To define a service operation, add the SysEntryPointAttribute attribute at the top of a method. Any existing method can be converted to a service operation by adding this attribute at the beginning of the method.
      • Note: The service operation name cannot include Create, Find, Update or Delete. These names are reserved to be used by AIF Document services. AX will make an exception when they are called from a client.
    • SysEntryPointAttribute:
      • SysEntryPointAttribute defines the authorization checks that will be performed when a method is called from the server. This attribute must be set on all the service operations. If the value is “true”, it means that authorization checks will be performed for all the tables accessed in the method and if set to “false”, no authorization checks will be performed.
    • AifCollectionTypeAttribute:
      • AifCollectionTypeAttribute is used when you want to use a collection as a return type or in a parameter of a service operation. This attribute defines the type of data a collection contains.


  • Creating our Custom Inbound Service:
    • Open AOT and go to Classes Create a new class and give it a name.
      • Img_020
    • Set its RunOn property to server in order to make sure it always runs on server.
      • Img_001
    • Add a new method to this class and name it. This method will be our service operation and we are going to pass our XML messages to this method. This method will perform appropriate actions in AX based on the XML message being passed. Please note we are taking string parameter and parse it into XML.
      • Img_002
    • The SysEntryPointAttributerefers that this is a service operation method.
    • We are creating XML document from the string parameter and based on the type of XML received we are going to execute separate logics.
      • Img_003
    • Go to Services, right click and select New Service. Name newly created service.
      • Img_006
    • Open the properties of the newly created service and select the service class name in the Class.
      • Img_004
    • Now expand the newly created Servicenode and add a new Operation by right clicking on Operations and selecting Add Operation.
      • Img_005
    • All service operations present in the class will be listed. Select the appropriate service operation by checking the Add field in the grid and press OK.
  • Now at this point, our service is created successfully and we need to create an enhanced inbound port to actually consume it.
  • In order to create an enhanced inbound port with HTTP adapter, we first need to configure Internet Information Services (IIS).


  • How to Configure IIS
    • For IIS 7.0, use the following steps to configure the application pool that is associated with Microsoft Dynamics AX web services. This step is required to set the correct version of the .NET Framework.
    • In Server Manager, Expand theServer Manager > Roles > Web Server (IIS) node and then click Internet Information Services (IIS) Manager.
    • In theConnections pane, expand the node for your server name and then click Application Pools.
    • In theApplication Pools pane, right-click the application pool that is associated with the Microsoft Dynamics AX web services and click Basic Settings….
    • In theEdit Application Pool dialog box, select .NET Framework 4.0 or a later version, such as 0.30319. Select Integrated from the Managed pipeline mode list. Notice that the Start application pool immediately option is selected. Click OK to return to Server Manager.
    • Restart the server.
      • Img_017
      • Img_018


  • Verify the website registration in Microsoft Dynamics AX
    • Use the following steps to register the website in Microsoft Dynamics AX.
    • ClickSystem administration > Setup > Services and Application Integration Framework > Web sites.
    • On theWeb sites form, verify that the website was created and has appropriate values for the NameVirtual directory share pathDescription, and URL  The default name is computername-Default Web Site-MicrosoftDynamicsAXAif60. The default URL is http://computername:8101/MicrosoftDynamicsAXAif60. The default share path for the virtual directory is \\computername\MicrosoftDynamicsAXAif60.
    • ClickValidate. Verify that the Infolog dialog confirms:
    • The website is configured properly.
    • You can access the computer and the website.
      • Img_015


  • Create and configure the integration port
    • When you create an integration port that uses the HTTP adapter, Application Integration Framework (AIF) publishes a Web Services Description Language (WSDL) document and related files to the website that you specify.
    • Open theInbound ports  Click System administration > Setup > Services and Application Integration Framework > Inbound ports.
    • ClickNew.
    • Name the new integration port.
    • In theAddress group, in the Adapter list, select HTTP.
    • In theURI field, click the arrow. The Select Web site form opens.
    • In theSelect Web site form, in the Web site field, select the default website in the list. Then close the form.
    • On theService contract customizations FastTab, click Service operations.
    • In theSelect service operations form, in the Remaining service operations list, select the service operation that you want to use. Click the left arrow button to move the service operation to the Selected service operations  Then close the form.
    • You can modify the document’s data policy to match the fields that you want to return in the response. If you do not specify a data policy, AIF includes all elements from the sales order’s schema in the response message. If you specify a data policy but do not modify the default data policy, only the default elements are included in the sales order’s schema.
    • Activate the integration port.
    • Make note of the address that is displayed in theWSDL URI
    • Close theInbound ports
      • Img_016

So, now our inbound port is created successfully and we can consume our service from any application.


  • Create a HTTP client application
    • This section describes how to create a simple client application that synchronously exchanges messages with the HTTP integration port. The code for the client application is written in the C# programming language. The sample application reads a sales order from Microsoft Dynamics AX, and then displays the sales order ID and the customer account number.
    • Open Visual Studio, and create a new application project in Visual C#. Name the project.
    • InSolution Explorer, right-click the project name, and then click Add Service Reference.
    • TheAdd Service Reference dialog box opens.
    • In theAddress box, enter the WSDL URI from the port that you created in the previous section. For example, the URI may be http://MyServer/MicrosoftDynamicsAXAif60/WebSalesOrderRead/xppservice.svc.
    • ClickGo. Wait for Visual Studio to find the service.
    • ClickOK to close the dialog box.
    • Open Program.cs. In the code editor, add your logic to consume the service.
    • Build the project.
      • Img_019

In our case, I created an ASP.NET website. This ASP.NET website is consuming our custom inbound service. Whenever the construction application post XML message on the URL of this website, it will take that XML and pass it to Microsoft Dynamics AX.

Leave a Reply

Recent Comments