Microsoft Dynamics NAV Connector 2.1 | MuleSoft Documentation
# Microsoft Dynamics NAV Connector 2.1
Anypoint Connector for Microsoft Dynamics NAV (NAV Connector) enables Mule apps to interact with Microsoft Dynamics NAV Web Services. Microsoft Dynamics NAV is a global enterprise resource planning (ERP) solution to assist with finance, manufacturing, customer relationship management, supply chains, analytics, and electronic commerce for small and medium-sized enterprise and local subsidiaries of large international groups.
The versions of Microsoft Dynamics NAV supported by this connector are:
  * 2013 R2


Release Notes: Microsoft Dynamics NAV Connector Release Notes Exchange: Microsoft Dynamics NAV Connector
## Before You Begin
To use this information, you should be familiar with Microsoft Dynamics NAV, Mule runtime engine (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 hardware and software requirements and compatibility information, see the Connector Release Notes.
To use this connector with Maven, view the pom.xml dependency information in the Dependency Snippets in Anypoint Exchange.
## POM File Information
```
<dependency>
 <groupId>com.mulesoft.connectors</groupId>
 <artifactId>mule-microsoft-dynamics-nav-connector</artifactId>
 <version>x.x.x</version>
 <classifier>mule-plugin</classifier>
</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**.
## Primary Use Cases
The Microsoft Dynamics NAV Connector supports these operations:
Operation | Description  
---|---  
Page Operation | Execute one of the operations defined in published Page SOAP services.  
Codeunit Operation | Execute one of the operations defined in published Codeunit SOAP services.  
OData Query | Execute a Query against one of the NAV entities using the OData endpoint.  
## Getting Started
Before creating a sample flow, a published Page Service is necessary. See below.
## 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 "nav".
  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 "nav" in the search field.
  4. Click this connector’s name in **Available modules**.
  5. Click **Add**.
  6. Click **Finish**.


### Configure in Studio
  1. Drag an HTTP Listener to the Studio Canvas.
    1. Set the Path.
    2. Click the green plus sign to configure the listener.
  2. Drag a Dynamics Nav operation to the Studio Canvas.
  3. Click the green plus sign to add a configuration for the connector.
  4. Complete these fields.
Parameter | Description  
---|---  
Domain of the Dynamics NAV instance.  
Username | The Windows username to connect to Dynamics NAV.  
Password | The password for the user to connect to Dynamics NAV.  
SOAP URL | Base URL where the SOAP services are exposed in the form `https://<Server>:<WebServicePort>/<ServerInstance>/WS`. Example: `https://hostname:7047/DynamicsNAV90/WS`  
OData URL | Base URL where the OData services are exposed in the form `https://<Server>:<WebServicePort>/<ServerInstance>/OData`. Example: `https://hostname:7048/DynamicsNAV90/OData`  
Company Name (Optional) | Dynamics NAV Company to which connect. In case the field is left blank, the default configured one is used.  
Disable Cn Check | For HTTPS certificates, if the certificate is not signed by a trusted partner, the server might respond with an Exception. To prevent this it is possible to disable the CN (Common Name) check. Note: this is not recommended for production environments.  
  5. Click OK
  6. Configure these fields:
     * Query: The query that to run on Dynamics Nav.
     * Fetch Size: Number of items retrieved on one page.


## Use Case: Studio
## USe Case: XML
```
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:nav="http://www.mulesoft.org/schema/mule/nav"
	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/nav
http://www.mulesoft.org/schema/mule/nav/current/mule-nav.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
		<http:listener-connection host="localhost" port="8081" />
	</http:listener-config>
	<nav:dynamics-nav-config name="Nav_Connector_Dynamics_nav_config"
   doc:name="Nav Connector Dynamics nav config">
  		<nav:ntlm-connection
      domain="${config.domain}"
      username="${config.username}"
      password="${config.password}"
      soapUrl="${config.soapUrl}"
      odataUrl="${config.odataUrl}"
      companyName="${config.companyName}"
      disableCnCheck="true" />
  </nav:dynamics-nav-config>
  <flow name="query-flow">
  		<http:listener doc:name="Listener"
      config-ref="HTTP_Listener_config"
      path="/query"/>
  		<nav:odata-query fetchSize="10" doc:name="Odata query"
      config-ref="Nav_Connector_Dynamics_nav_config">
  			<nav:query>dsql: SELECT No FROM SalesOrders LIMIT 5</nav:query>
  		</nav:odata-query>
  		<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>
```

## See Also
  * Published Page Service information
  * Microsoft Dynamics NAV Web Services site
  * MuleSoft Help Center