Introduction
This sample demonstrates how to develop a mobile client app that communicates with Microsoft Dynamics AX 2012 from phone or tablet platforms. The sample app enables an employee to submit expense reports from a mobile device while traveling. See
related code sample
Developing Secure Mobile Apps for Dynamics AX 2012 - Connector
The code provided in this sample supports the walkthroughs in Developing
Secure Mobile Apps for Dynamics AX 2012 white paper. Refer to the white paper for a detailed
description of the solution architecture and implementation.
A mobile app for Dynamics AX 2012 enables users to send transactions to Dynamics AX 2012 even if they are not in the same domain or network as the on-premises instance of AX. For example, the solution lets clients access an AX service that may be running
behind a firewall. The solution involves the following components:
- An AIF service. This communicates data to and from the AX 2012 database.
- A middle-tier WCF service. This makes use of the Windows Azure Service Bus and its relayed messaging capability to expose the on-premises service to mobile clients.
- A mobile client. The client communicates with the middle-tier WCF service. The client implements active federation and claims-based authentication to authenticate the user before sending data to the service.
The following diagram illustrates how different components interact to enable the mobile app to communicate with Microsoft Dynamics AX.

The following walkthroughs in Developing Secure Mobile Apps for Dynamics AX 2012, which correspond to the source
code files in this sample, demonstrate the steps for creating a mobile client app:
- Design and create the AIF service in Microsoft Dynamics AX 2012
- Create the middle-tier WCF service
- Develop the client to communicate data to the middle-tier WCF service
- Implement active federation and claims-based authorization for the mobile client
- Authenticate the user and send the data to the service
Source Code Files
The development environment and pre-requisites, can be found in the walkthroughs for each of
these components.
- ContosoMobileWindowsPhone:
This folder contains the Windows Phone implementation of the mobile client. The client communicates to the WCF service and implements authentication to ADFS. This is a Visual Studio project which needs the Windows Phone SDK installed as a prerequisite
for Windows Phone 8 or 7.1. This corresponds with the walkthroughs entitled ‘Develop the client to communicate data to the middle-tier WCF service’, ‘Implement active federation and claims-based authorization for the mobile client’,
and ‘Authenticate the user and send the data to the
service’ in
Developing Secure Mobile Apps for Dynamics AX 2012. - ContosoMobileJSClient: This folder contains the JavaScript
implementation for the mobile client. This corresponds to the ‘Developing RESTful JavaScript Mobile Apps for Dynamics AX 2012’ section in
Developing Secure Mobile Apps for Dynamics AX 2012. The code demonstrates communication with the WCF service as well as authentication to ADFS.
See the related code sample
Developing Secure Mobile Apps for Dynamics AX 2012 - Connector
- ExpenseConnectorService:
This folder contains a Visual Studio 2010 project that implements the Middle-Tier WCF service. This code corresponds to the ‘Create the Middle-Tier WCF Service’ walkthrough in
Developing
Secure Mobile Apps for Dynamics AX 2012. This also contains the windows installer project to install the service, which is ‘SampleConnectorWindowsService’. This folder also contains
Sample_Expense_Mobile_Capture.xpo: Which contains X++ code for the AIF service described in the walkthrough and needs to be imported into Dynamics AX from the Development environment. This code corresponds to the ‘Design and create
the AIF service in Microsoft Dynamics AX 2012’ walk through in
Developing
Secure Mobile Apps for Dynamics AX 2012.
Building the Sample
Prerequisites
Building the projects
- To build the ExpenseConnectorService and ContosoMobileWindowsPhone
projects, use the build command in Visual Studio.
- To run the ContosoMobileJSClient code, Open ‘SampleClient’ in the browser. To view any messages logged by the JavaScript code you can use the Internet Explorer Developer Toolbar’s console window.
More Information