Services have been around for some time in Microsoft Dynamics AX. AIF was initially introduced with the release of Microsoft Dynamics AX 4.0 and Microsoft Dynamics AX 2009 continued to build on that. But now with the latest release of Microsoft Dynamics AX 2012, Microsoft has really succeeded in bringing the service functionality to a whole new level. Let us take a walk through the major changes that Microsoft Dynamics AX 2012 brings to the table.
The first major feature that has been added to this release is that the AOS is now the host for the Microsoft Dynamics AX 2012 services. In previous releases, the exchange of messages was either through adapters such as the file system, BizTalk, and MSMQ adapter, or services that were exposed as WCF 3.5 services through IIS. With the latter, IIS was acting as the host for the WCF services.
With this new release of Microsoft Dynamics AX, services will be exposed as WCF 4.0 services hosted directly in the AOS Windows service. As long as intranet users and applications are consuming these services, no IIS is needed.
Microsoft Dynamics AX 2012 provides a lot more support for WCF. Proprietary adapters such as the BizTalk adapter and the MSMQ adapter that were previously available, are now obsolete and no longer available. Instead, support for MSMQ and BizTalk is provided by a native WCF equivalent of these adapters.
This does not mean that creating custom adapters using the AIF adapter framework is not supported anymore. Custom adapters can still be added by implementing the
Out-of-the-box, Microsoft Dynamics AX 2012 comes with the following adapters:
NetTcp adapter: The NetTcp adapter is the default adapter used when creating a new integration port. This adapter type corresponds to the WCF
NetTcpBinding. It provides synchronous message exchanges by using WS-* standards over the Transmission Control Protocol (TCP).
HTTP adapter: The HTTP adapter supports synchronous message exchanges over the HTTP and HTTPS protocols. This was already available in Microsoft Dynamics AX 2009, but there is a difference in the deployment to the IIS. The business connector is no longer used for services hosted on the IIS; instead a WCF routing service is used. There is more about routing services later in this chapter.
More information about the bindings that are used in these adapters can be found on MSDN at http://msdn.microsoft.com/en-us/library/ms733027.aspx. If you want to learn more about WS-* standards, check out the Web Services Specification Index Page at http://msdn.microsoft.com/en-us/library/ms951274.aspx.
Now, integration ports have been added and they provide a simpler way of configuring services. There are two types of integration ports: inbound and outbound, depending on whether the message originates from outside or inside Microsoft Dynamics AX.
The inbound integration ports can be divided into two types: basic or enhanced. Out-of-the-box, Microsoft Dynamics AX 2012 already has some services that are associated with basic integration ports. These have been deployed and enabled by default. We will discuss how these basic ports differ from enhanced ports in later chapters.
Instead of having Microsoft Dynamics AX specific endpoints and channels, integration ports use native WCF to deploy services and therefore endpoints, security, behaviors, bindings, and so on. All of this is configured using the WCF Configuration utility. By default, integration ports are hosted on the AOS using the
Previously, when services were deployed on IIS, they used the .NET Business Connector to communicate to the AOS. This has been replaced by a WCF routing service that implements the
IRequestReplyRouter interface. Regardless of whether services are consumed from the intranet or the Internet, they are always processed by the AOS. So when services are deployed to be used on the Internet, they will be deployed both on the AOS and on the IIS. The AOS hosts the service using the
NetTcp binding and the IIS has a WCF routing service that will forward service requests to the internal services hosted on the AOS.
Using transformations, Microsoft Dynamics 2012 can transform inbound messages from a variety of formats into the format AIF can understand. Likewise, outbound messages can be transformed from the AIF format into the format required by external systems. There are two types of transformations that can be used: Extensible Stylesheet Language Transformations (XSLT) and .NET assemblies.
You can create XSLT transformations by using any text editor, but tools such as BizTalk MAPPER, Visual Studio, or Altova MapForce make it very easy. .NET assemblies are DLL files that can be compiled using Visual Studio and do transformations in code. This is especially convenient for transforming from or into a non-XML format. Some of the tools available can actually generate both the XSLT and the managed code needed to compile a .NET assembly.
In Microsoft Dynamics AX 2012, there are two additional operations available for developers:
GetKeysaction can be used in combination with a document filter to only obtain the keys of the documents that were the result of the filter.
GetChangedKeysaction does the same as the
GetKeysoperation with the addition of a date and time being passed to the action. This way only the keys of documents that have actually changed since that time are returned.
One of the major changes in Microsoft Dynamics AX 2012 is the ease and flexibility by which you can create custom services. Instead of having to provide all the technical details on how the documents need to be serialized by implementing
AifSerializable, you can now easily attribute class instance methods. These attributes are used to identify service operations and data contract members.
In Microsoft Dynamics AX 2012, the SysOperation framework allows you to leverage the power of services to execute your business logic in Microsoft Dynamics AX. When you create a service, it encapsulates the business logic so other components within the system can use the service instead of accessing the business logic themselves.
The SysOperation framework makes use of the Model-View-Controller (MVC) pattern by using multiple components that each have their own responsibilities. These components separate the business logic from the code that is responsible for rendering the GUI and the classes that represent the data model. This is a great leap forward from Microsoft Dynamics AX 2009, where everything was written in one class that extended Runbase.
Also important to note is that when a service has been created for the SysOperation framework, it requires little effort to expose the same service to the outside world. You can simply expose it using an integration port.
It facilitates a service-oriented approach within Microsoft Dynamics AX
It implements the MVC pattern for more efficient client/server communication and separation of responsibilities
The GUI is automatically generated based on data contracts
Less extra effort in exposing business functionality externally using services