Microsoft Dynamics AX 2012 Connector
Introduction
The Anypoint Connector for Microsoft Dynamics AX 2012 (Microsoft Dynamics AX 2012 Connector) enables Mule applications to interact with the Microsoft Dynamics AX Query Service. Microsoft Dynamics AX is an enterprise resource planning (ERP) application.
Release Notes: Microsoft Dynamics AX 2012 Connector Release Notes
Example Apps Using Connector: dynamics-ax-2012-samples.zip
The Microsoft Dynamics AX 2012 Connector supports these operations:
Operation | Description |
---|---|
Query table |
Run a query against an Application Object Tree (AOT) Table. For more information, see the Microsoft AOT table site. |
Static query |
Run an AOT static query. |
Document Service |
Call an AIF Document Service. |
Before You Begin
The following prerequisites must be satisfied before running the Dynamics AX connector:
Install the Windows Gateway Services
Windows Gateway Services for Anypoint Platform
The Windows Gateway Services agent performs protocol translation when calling the Dynamics AX System Services. The Dynamics AX System Services (Metadata Service, Query Service) use the net.tcp
protocol which is not implemented in Java.
To execute requests, the connector routes the requests through the Windows Gateway Services as follows:
-
The connector sends an HTTP request to the Windows Gateway Services.
-
The Windows Gateway Services receives the HTTP request.
-
The Windows Gateway Services executes the request against the Dynamics AX System Services using the
net.tcp
protocol. -
The Windows Gateway Services receives the response from the Dynamics AX System Services.
-
The Windows Gateway Services sends the response to the connector over HTTP.
-
The connector receives the response.
All communication between the Anypoint Platform and Windows Gateway Services is authenticated and secured by SSL.
To Install this Connector
-
In Anypoint Studio, click the Exchange icon in the Studio taskbar.
-
Click Login in Anypoint Exchange.
-
Search for the connector and click Install.
-
Follow the prompts to install the connector.
When Studio has an update, a message displays in the lower right corner, which you can click to install the update.
Configuring the Connector
Step 1: Create a New Mule Project
Open Anypoint Studio and create a new project:
-
From the menu, select File > New > Mule Project.
-
In the New Mule Project window, enter ax-demo as the Project Name.
-
Click Finish.
Step 2: Create and Configure a New Microsoft Dynamics AX Global Element
Configure the connector’s connection:
-
Click the Global Elements tab.
-
Click Create to bring up Global Type dialog box.
-
In the Search text box, enter ax.
-
Select Microsoft Dynamics AX: Gateway Connection and click OK.
-
Fill in the required parameters:
Parameter Description Username
The username to connect to Dynamics AX.
Password
The password to connect to Dynamics AX.
AOS Server Name
The name or IP of the server on which the Application Object Server is running.
AOS Services WSDL Port
(v 1.1.0 and newer) The port number that the WSDL Services runs on. The default port number is
8101
.Gateway Router Service Uri
The address (host and port) of the Windows Gateway Services. This address is usually similar to
https://myserver.com:9333/router
.AOS Services Endpoint Port (Optional)
(v 1.1.0 and newer) Use this configuration to override the service endpoint that is specified in the Services' WSDL document.
Figure 1. Microsoft Dynamics AX 2012 Connector Global Element < v1.0.0Figure 2. Microsoft Dynamics AX 2012 Connector Global Element v1.1.0 and above -
Click Test Connection to make sure the connection works correctly.
-
Once the connection is successful, click OK.
Step 3: Create a Flow to Query Dynamics AX
Creating a Mule flow to query the "ProjTable".
To create the Mule flow, follow these steps:
-
Click the Message Flow tab.
-
Search for http and drag an HTTP connector onto the canvas. This creates a new flow.
-
Search for ax and drag the Microsoft Dynamics AX 2012 connector next to the HTTP connector, in the Process area.
-
Search for json and drag an Object to JSON transformer next to Microsoft Dynamics AX 2012.
-
Double-click the HTTP connector. Click the plus sign (+) beside the Connector Configuration list.
-
In the HTTP Listener Configuration window, make sure Protocol is set to HTTP, Host is set to All Interfaces [0.0.0.0] (Default) and Port is set to 8081. Click OK.
-
Under Basic Settings, set the Path to /query.
-
Double-click Microsoft Dynamics AX 2012 and update the following configuration values:
-
From the Connector Configuration list, select the Microsoft Dynamics AX 2012 Connector configuration that was previously created.
-
From the Operation list, select Query table.
-
From the Language list, click DataSense Query Language.
-
Click Query Builder…
-
From the list of Types, select ProjTable.
-
From the list of Fields, select ProjId and ProjGroupId.
-
From the Order By dropdown, select ProjId.
-
From the Direction dropdown, select DESCENDING.
-
-
Click OK.
Step 4: Running the Flow
-
In Package Explorer, right click demo-ax and select Run As > Mule Application.
-
Check the console to see when the application starts. You should see the following message if no errors occurred:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Started app 'ax-demo' + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [main] org.mule.module.launcher.DeploymentDirectoryWatcher: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Mule is up and kicking (every 5000ms) + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [main] org.mule.module.launcher.StartupSummaryDeploymentListener: ********************************************************************** * - - + DOMAIN + - - * - - + STATUS + - - * ********************************************************************** * default * DEPLOYED * ********************************************************************** ************************************************************************************* * - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS * ************************************************************************************* * ax-demo * default * DEPLOYED * *************************************************************************************
-
Open an Internet browser and visit http://localhost:8081/query
-
The list of accounts ordered by descending name should be returned in JSON format (results vary according to your AX instance).
[{"ProjId":"DAT-000009","ProjGroupId":"Group-2"},{"ProjId":"DAT-000008","ProjGroupId":"Group-1"},{"ProjId":"DAT-000007","ProjGroupId":"Group-0"}]
Using the Connector
Namespace and Schema
When designing your application in Studio, the act of dragging the connector from the palette onto the Anypoint Studio canvas should automatically populate the XML code with the connector namespace and schema location.
Namespace: http://www.mulesoft.org/schema/mule/dynamicsax
Schema Location: http://www.mulesoft.org/schema/mule/dynamicsax/current/mule-dynamicsax.xsd
If you are manually coding the Mule application in Studio’s XML editor or other text editor, paste these into the header of your Configuration XML, inside the <mule> tag.
|
<mule xmlns:dynamicsax="http://www.mulesoft.org/schema/mule/dynamicsax"
...
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/dynamicsax http://www.mulesoft.org/schema/mule/dynamicsax/current/mule-dynamicsax.xsd">
...
<flow name="yourFlow">
...
</flow>
</mule>
Using Call Context
The connector supports providing a fixed Call Context within each call that can be setup at the configuration tab with the same name.
Within the configuration section you can set the following:
Setting | Description |
---|---|
Company |
This is the Microsoft Dynamics AX company for the data on which the service operation is performed. If Company is not specified then the calling user’s default company is used. |
Language |
This is the Microsoft Dynamics AX LanguageID for the language that is used to display messages. The default value for Language is 'en-us'. |
Logon As User |
This is the Microsoft Dynamics AX user who performs the service operation. It uses the submitting user (calling user) in the format 'domain\user'. If LogonAsUser is not specified then the user who makes the service operation call is used. The default user depends on the adapter that is selected. For example, when you use the file system adapter the default user is the owner of the folder where the file resides. |
Message ID |
This is the GUID that uniquely identifies each document. If you do not specify a message ID, the system generates one. However, if you want to identify a particular message for debugging, you must specify the message ID as part of the call context. |
Partition Key |
This value identifies the partition that contains data that is referenced by the service operation. The default value for PartitionKey is the default partition set for the calling user. |
Operations
Query Table
Run a query on an AOT table.
Static Query
Run an AOT static query.
Static Query Input
The following table details the operation’s input parameters.
Parameter | Description |
---|---|
staticQueryName |
The name of the static query to execute. |
fetchSize |
The size of the page for paging the results. |
Message Payload |
For static queries that accept input parameters, a |
Document Service
Call an AIF Document Service.
Document Service Input
The following table details the operation’s input parameters.
Parameter | Description |
---|---|
serviceAndSoapActionUri |
The Document Service name and the SOAP action URI, concatenated in the format: |
Message Payload |
The XML document that is sent to the operation. |
Using the Connector in a Mavenized Mule App
If you are coding a Mavenized Mule application, this XML snippet must be included in your pom.xml
file.
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-dynamics-ax-2012</artifactId>
<version>x.x.x</version>
</dependency>
Replace x.x.x
with the version that corresponds to the connector you are using.
To obtain the most up-to-date pom.xml
file information, access the connector in Anypoint Exchange and click Dependency Snippets.
Demo Applications Using the Connector
Starting the Demo
-
Import the project folder in Studio.
-
Update the Microsoft Dynamics AX connection parameters in
/src/main/app/mule-app.properties
. -
Click Test Connection to make sure the connection works correctly.
-
Run the application.
Running the Demo
The demo includes the following operations:
-
Query all projects from ProjTable table:
http://localhost:8081/projects
-
List all projects (static query ProjListProjectTable):
http://localhost:8081/list-projects
-
Get project by ProjId (static query ProjListProjectTable):
http://localhost:8081/list-projects?ProjId={projid}