Building  Custom Web API  for Microsoft Dynamics AX 2012

System Architect

Generic MS Dynamics AX System Architecture

beehexa dd362112ax6 sysdocs systemarchitectureax60 1

According to the application, we can always write a custom web application to interact with Dynamics AX through an Application Object Server (AOS). The AOS Architecture can be checked in the following section. 

AOS – Application Object Server

beehexa dd309593aosax60

An Application Object Server (AOS) instance is a core component of your Microsoft Dynamics AX installation and is installed by using Setup. An AOS instance enforces security, manages connections between clients and the database, and provides the foundation where Microsoft Dynamics AX business logic runs. The topics in this section describe the various roles in which AOS can function. 

How Beehexa build Custom API for Dynamics AX 2012

AOS System Architecture Overview

In Microsoft Dynamics AX, there is a 3-tier infrastructure with a database server, an application object server (AOS), and a client. The database server contains the table data. The AOS is used to execute application objects, such as queries and classes. Application objects in the user interface, such as forms and reports, run on the client computer. This topic describes how to develop an application using the different tiers and how record buffers are related to the tiers.

beehexa aa660629dvg 3 tier architectureen usax60

We can use the above architecture to build a custom Web API for MS Dynamics AX. 

The Web API will be the Tier One above to interact with the Database through Application Object Server with custom X++ source code.

What is MorphX?

MorphX is the integrated development environment (IDE) in Microsoft Dynamics AX. It includes tools for designing, editing, compiling, and debugging code in Microsoft Dynamics AX. 

beehexa 111

Using  MorphX with custom X++ source code, we can build any custom Client Application to interact with Microsoft Dynamics DB through AOS. 

The Client Application here can be a Web API. 

What is X++ Programming Language? 

X++ is an object-oriented language with similarities to C#. X++ is part of the MorphX development platform that you use to construct accounting and business management systems.

Basic ASP.Net Web API Architecture

According to MS tutorial here, we can build a simple web rest API as described below:

beehexa basic aspnet web api architecture
beehexa basic aspnet web api architecture

A simple API Endpoint can look like below

using DynamicsAX2012Api.Helper;
using System;
using System.Net.Http;
using System.Web.Http;


namespace DynamicsAX2012Api.Controllers
{
    public class HomeController : ApiController
    {
        [HttpGet]
        public HttpResponseMessage Index()
        {
            var response = new HttpResponseMessage();
            response.Content = new StringContent(@"
                HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Transform Business", System.Text.Encoding.UTF8, "text/html");
            return response;
        }
    }
}

Dynamics AX Custom Web API Architecture

beehexa 3

There are two main components to build the Custom Web API to work with MS Dynamics AX. 

  1. Custom ASP.Net Web API to run on IIS Web Server
  2. Custom X++ Source Code to deploy on Application Object Server using MorphX

References

  1. https://learn.microsoft.com/en-us/dynamicsax-2012/appuser-itpro/system-architecture
  2. https://learn.microsoft.com/en-us/aspnet/web-api/overview/older-versions/build-restful-apis-with-aspnet-web-api
  3. https://learn.microsoft.com/en-us/aspnet/whitepapers/aspnet-and-web-tools-20122-release-notes
  4. https://devblogs.microsoft.com/dotnet/list-of-asp-net-web-api-and-httpclient-samples
  5. https://learn.microsoft.com/en-us/dynamicsax-2012/developer/microsoft-dynamics-ax-ide
  6. https://learn.microsoft.com/en-us/dynamicsax-2012/developer/x-language-programming-guide
  7. https://learn.microsoft.com/en-us/dynamicsax-2012/appuser-itpro/large-scale-deployment

Get started for free

You can’t add more hours to the day. Beehexa is the next best thing.