Contact Free trial Login

Microsoft Dynamics AX Connector - Mule 4

Support Category: Select

Microsoft Dynamics AX Connector v2.0

Anypoint Connector for Microsoft Dynamics AX (Dynamics AX Connector) enables Mule apps to interact with the Microsoft Dynamics AX Query Service.

This connector supports the following operations:

  • Run a query against an AOT table.

  • Run an AOT static query.

  • Call an AIF Document Service.

The connector supports Microsoft Dynamics AX 2012.

Prerequisites

To use this information, you must be familiar with Microsoft Dynamics AX, Mule, Anypoint Connectors, Anypoint Studio, Mule concepts, elements in a Mule flow, and Global Elements.

You need login credentials to test your connection to your target resource.

For software requirements and compatibility information, see the Connector Release Notes.

Install the Windows Gateway Services for Anypoint Platform.

POM File Information

<dependency>
  <groupId>com.mulesoft.connectors</groupId>
  <artifactId>mule-microsoft-dynamics-ax-connector</artifactId>
  <version>RELEASE</version>
  <classifier>mule-plugin</classifier>
</dependency>

Mule converts RELEASE to the latest version. To specify a version, view Microsoft Dynamics AX Connector in Anypoint Exchange and click Dependency Snippets.

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

ms dynamics ax protocol translation
  1. The connector sends an HTTP request to the Windows Gateway Services.

  2. The Windows Gateway Services receives the HTTP request.

  3. The Windows Gateway Services executes the request against the Dynamics AX System Services using the netTcp protocol.

  4. The Windows Gateway Services receives the response from the Dynamics AX System Services.

  5. The Windows Gateway Services sends the response to the connector over HTTP.

  6. The connector receives the response.

All communication between the Anypoint Platform and Windows Gateway Services is authenticated and secured by SSL.

Connect in Design Center

  1. Click a trigger such as HTTP Listener or Scheduler.

    ms dynamics ax design listener
  2. Click the plus sign and search for Dynamics Ax Connector and select Query Table Operation.

  3. Click Edit to configure the connector.

  4. For general settings, complete these fields:

    • Company: Sets the company to use within all calls.

    • Language: Sets the language to use within all calls.

    • Log on as user: Sets the user to use within all calls.

    • Message id: Sets the message ID to use within all calls.

    • Partition key: Sets the partition key to use within all calls.

      Connection 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 where the Application Object Server is running on.

      AOS Services WSDL Port

      The port number that the Services WSDL run on. Default is 8101.

      Gateway Router Service Url

      The address (host and port) of the Windows Gateway Services. This address is usually similar to https://myserver.com:9333/router

  5. For advanced connection complete these fields:

    • AOS Endpoint Port (Optional) - Use this configuration to override the service endpoint that is in the services' WSDL document.

    • Connection timeout - Used to set connection timeout for connector requests. This optional value is in milliseconds (0 for unlimited timeout).

    • Receive timeout - Use to set reception timeout for connector requests. This optional value is in milliseconds.

  6. Complete the Query with: dsql:SELECT Name,Type FROM ProjTable

  7. Complete Fetch Size with: 20

ms dynamics ax design operation

Connect in Anypoint Studio 7

You can use this connector in Anypoint Studio by first downloading it from Exchange and configuring it as needed.

Add the Connector to a Studio Project

Anypoint Studio provides two ways to add the connector to your Studio project: from the Exchange button in the Studio taskbar or from the Mule Palette view.

Add the Connector Using Exchange

  1. In Studio, create a Mule project.

  2. Click the Exchange icon (X) in the upper-left of the Studio task bar.

  3. In Exchange, click Login and supply your Anypoint Platform username and password.

  4. In Exchange, search for "ax".

  5. Select the connector and click Add to project.

  6. Follow the prompts to install the connector.

Add the Connector in Studio

  1. In Studio, create a Mule project.

  2. In the Mule Palette view, click (X) Search in Exchange.

  3. In Add Modules to Project, type "ax" in the search field.

  4. Click this connector’s name in Available modules.

  5. Click Add.

  6. Click Finish.

Configure in Studio

  1. Drag a connector operation to the Studio Canvas.

    ms dynamics ax component
  2. For general settings complete these fields:

    ms dynamics ax any config
    • Company: Sets the company to use within all calls.

    • Language: Sets the language to use within all calls.

    • Log on as user: Sets the user to use within all calls.

    • Message id: Sets the message ID to use within all calls.

    • Partition key: Sets the partition key to use within all calls.

      Connection 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 where the Application Object Server is running.

      AOS Services WSDL Port

      The port number that the Services WSDL run on. Default is 8101.

      Gateway Router Service Url

      The address (host and port) of the Windows Gateway Services. This address is usually similar to https://myserver.com:9333/router

For advanced connection complete these fields:

ms dynamics ax any advanced config
  • AOS Endpoint Port (Optional) - Use this configuration to override the service endpoint that is in the services' WSDL document.

  • Connection timeout - Used to set connection timeout for connector requests. This optional value is in milliseconds (0 for unlimited timeout).

  • Receive timeout - Use to set reception timeout for connector requests. This optional value is in milliseconds.

Use Case: Query Table

  1. Add an HTTP Listener to the flow.

  2. Click the green plus sign to configure it.

  3. Set Host to localhost and Port to 8080.

  4. Click OK.

  5. Add Query Table operation from Microsoft Dynamics AX pallette.

  6. Configure connection by clicking on the green plus sign

  7. Set the above mentioned fields

  8. Complete the Query parameter with dsql:Select Name from ProjTable

  9. Add a Transform Message and set it with following:

    %dw 2.0
    output application/json
    payload
  10. Perform a curl to localhost:8080

Use Case XML

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
      xmlns:microsoft-dynamics-ax="http://www.mulesoft.org/schema/mule/microsoft-dynamics-ax"
      xmlns:http="http://www.mulesoft.org/schema/mule/http"
      xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
      http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/microsoft-dynamics-ax
http://www.mulesoft.org/schema/mule/microsoft-dynamics-ax/current/mule-microsoft-dynamics-ax.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
    <configuration-properties file="mule-app.properties"/>

    <http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
        <http:listener-connection host="localhost" port="8082"/>
    </http:listener-config>

    <microsoft-dynamics-ax:dynamics-ax-config name="Microsoft_Dynamics_AX_Dynamics_AX"
         doc:name="Microsoft Dynamics AX Dynamics AX">
        <microsoft-dynamics-ax:soap-connection disableCnCheck="true"
         gatewayRouterServiceAddress="${gateway-connection-config.gatewayRouterServiceAddress}"
         username="${gateway-connection-config.username}"
         password="${gateway-connection-config.password}"
         aosServerName="${gateway-connection-config.aosServerName}"
         aosWsdlPort="${gateway-connection-config.aosWsdlPort}"/>
    </microsoft-dynamics-ax:dynamics-ax-config>

    <flow name="dynamics-old-ax-demoFlow2">
        <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/query"/>
        <set-payload value="#[attributes.queryParams.queryToExecute]" doc:name="Set Payload"/>
        <microsoft-dynamics-ax:query-table itemsPerPage="5" doc:name="Query table"
              config-ref="Microsoft_Dynamics_AX_Dynamics_AX">
            <microsoft-dynamics-ax:query>#[payload]</microsoft-dynamics-ax:query>
        </microsoft-dynamics-ax:query-table>
        <ee:transform doc:name="Transform Message">
            <ee:message>
                <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
            </ee:message>
        </ee:transform>
    </flow>

</mule>
ms dynamics ax use case