Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
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

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

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime
Banner background image