Microsoft Dynamics AX 2012 R3 for Retail-Development & Customization

Microsoft Dynamics AX 2012 R3 for Retail-Development and Customization

Locus IT ServicesMicrosoft Dynamics AX 2012 R3 for Retail-Development and Customization

Lesson 2: How to: Add a New AJAX Service to the Storefront

How to: Add a New AJAX Service to the Storefront

How to: Add a New AJAX Service to the Storefront : Creation of a new AJAX Service requires the following general steps:

  1. Create an interface for your service. The interface should have the ServiceContract attribute declaration.  Define the methods that your service will expose and mark them with the OperationContract attribute.  This is your service API.
  2. Create the service. The service contains the methods that will be called from the JavaScript in your pages.  This should be a very lightweight interface that does not contain business logic. It implements the interface you created in the previous step.  The service method calls a method on a controller and returns a response object.  Services reside in the SharePoint.Web.Services project’s ISAPI subdirectory.
  3. Create a controller. The controller contains implementation details for creating, updating, reading, deleting data to/from the CRT or other data sources. The controller is called by the service method and returns a front-end object or collection instance.  Controllers reside in the SharePoint.Web.Services project’s ObjectModel subdirectory.
  4. Create a mapper (optional). A mapper converts an object from its back-end representation to a front-end representation of the object.  They are used in controllers.  It is optional to create a new mapper as you may be able to utilize one of the existing mapper classes.  Mappers reside in the SharePoint.Web.Services project’s ObjectModel subdirectory.
  5. Create a response object (optional). A response object encapsulates the data your service is returning to the page.  It is utilized in the service method to wrap the data returned from the controller into a response to be consumed by the page.  It is optional to create a new response object as you may be able to utilize one of the existing response classes.  Response objects reside in the SharePoint.Web.Services project’s ViewModel subdirectory.

Lesson Objectives

To understand how to create an AJAX service to connect to Storefront.

Getting Started

  1. Download and install the Dynamics AX 2012 for Retail SDK
  2. Open the solution file e.g. C:\Users\<username>\My Documents\Channels\SharePoint\Solution\RetailStoreFront.sln
Locus IT Project Management Office
What’s it?