Book Image

Microsoft Dynamics AX 2012 Services

By : Kenny Saelen, Klaas Deforche, Saelen Kenny
Book Image

Microsoft Dynamics AX 2012 Services

By: Kenny Saelen, Klaas Deforche, Saelen Kenny

Overview of this book

Because an ERP system like Microsoft Dynamics AX 2012 plays a central role in an organization, there will always be the need to integrate it with other applications. In many cases, services are the preferred way of doing this, and Microsoft Dynamics AX 2012 is now more flexible than ever when it comes to the creation and use of these services. Understanding these services will help you identify where they can be used, and do so effectively."Microsoft Dynamics AX 2012 Services" is a hands-on guide that provides you with all the knowledge you will need to implement services with Microsoft Dynamics AX 2012. The step-by-step examples will walk you through many of the tasks that you need to perform frequently when creating and using services."Microsoft Dynamics AX 2012 Services" provides detailed and practical examples for creating and using services that will make it a resource you will consult many times during your implementationsThis book helps you to identify situations where services can be used for your implementations. By providing step-by-step instructions for many of the common tasks, you will gain practical know-how on to get the job done.Easy to follow instructions are provided for all types of services you will encounter. You will learn how to create document services using the AIF Document Service Wizard and how to use X++ to create custom services. You will also learn how to deploy services and web services and how you can consume them in both X++ and .NET. The services are also put to use in the SysOperation framework, which uses services to run business logic and is the new way to create batch processes in Microsoft Dynamics AX 2012.
Table of Contents (14 chapters)

Creating custom services


In this section, we will discuss two custom services. One service focuses on exposing data from Microsoft Dynamics AX 2012, the other on exposing business logic.

The Title service

We will use the CVRTitleService service as an example to demonstrate how to create a simple yet powerful service. The service will allow an external program to do the following two things:

  • Retrieve details of a title based on its ID

  • Retrieve a list of all titles

The Title data contract

Let's start by creating a new class for the data contract that will contain the data for one title. Create a new class and name it CVRTitleContract. In the class declaration, add DataContractAttribute to specify that the class is a data contract. Also declare the variable's ID, name, and description as shown in the following code snippet:

[DataContractAttribute('Title')]
public class CVRTitleDataContract
{
  CVRTitleId      id;
  CVRTitleName    name;
  Description     description;
}

Next, add three parameter methods...