Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Dynamics AX 2012 Services

You're reading from   Microsoft Dynamics AX 2012 Services Everything you need to know about implementing services with Microsoft Dynamics AX 2012 is contained in this hands-on guide. Easy to follow and totally practical, it's a must for both new and experienced AX Dynamics developers.

Arrow left icon
Product type Paperback
Published in Dec 2012
Publisher Packt
ISBN-13 9781849687546
Length 196 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

What's new?

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.

AOS WCF service host

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.

WCF adapters

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 AifIntegrationAdapter interface.

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).
  • File system adapter: The file system adapter can be used for asynchronous exchange of XML messages stored in file system directories.
  • MSMQ adapter: The MSMQ adapter is used when support for queuing is needed. Message exchange is asynchronous and uses MSMQ. Note that choosing this adapter type actually uses the WCF NetMsmq binding.
  • 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.

Note

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.

Integration ports

In Microsoft Dynamics AX 2009, there was a lot of configuration required to get AIF up and running. This included configuration of the following:

  • Endpoints
  • Local endpoints
  • Channels
  • Endpoint users
  • Endpoint constraints

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.

Integration ports

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 NetTcp binding.

IIS hosting without Business Connector

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.

Non-XML support

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.

AIF change tracking

In Microsoft Dynamics AX 2009, document services had a set of six operations available for use:

  • Create
  • Delete
  • Find
  • FindKeys
  • Read
  • Update

In Microsoft Dynamics AX 2012, there are two additional operations available for developers:

  • GetKeys: The GetKeys action can be used in combination with a document filter to only obtain the keys of the documents that were the result of the filter.
  • GetChangedKeys: The GetChangedKeys action does the same as the GetKeys operation 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.

Custom services

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.

The SysOperation framework

Prior to Microsoft Dynamics AX 2012, the RunBase framework was used to provide a generic way of creating processes and batch jobs in the system.

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.

So the advantages of the SysOperation framework can be summarized as follows:

  • 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
You have been reading a chapter from
Microsoft Dynamics AX 2012 Services
Published in: Dec 2012
Publisher: Packt
ISBN-13: 9781849687546
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime