Microsoft Dynamics NAV Web Services

Microsoft Dynamics NAV 2009 provides Web services, which makes it easy for other systems to integrate with Microsoft Dynamics NAV.

Web service integration with Microsoft Dynamics NAV is supported through Web service–enabled pages and codeunits. With proper authentication and authorization, external systems can read and write data on pages and call codeunits as XML Web services using SOAP over HTTP and having their interfaces exposed in a WSDL. When pages and codeunits are published as Web services from Microsoft Dynamics NAV, they are immediately available for Web service requests over the network.

Different Types of Web Services

Microsoft Dynamics NAV supports exposing pages and codeunits as Web services. Pages and codeunits can be combined to offer more functionality on the page Web service.

Page Web Services

When a page is exposed as a Web service, a default set of operations is exposed to developers so that they can manage common record handling operations such as Create, Read, Update, and Delete. Page-based Web services offer built-in optimistic concurrency management. Each operation call in a page-based Web service is managed as a single transaction.

You can also use extension codeunits to extend the default set of operations that are available on a page. Adding an extension codeunit to a page is useful if you want to perform operations other than the standard Create, Read, Update, and Delete operations.

The benefit of adding an extension codeunit to a page is that you can make the Web service more complete by adding operations that are logical to that service. Those operations can use the same object identification principle as the basic page operations.

Codeunit Web Services

Codeunit Web services provide you with the most control and flexibility. When a codeunit is exposed as a Web service, no default set of operations is exposed. You can decide which operations are available on a codeunit.

The Microsoft Dynamics NAV Web services service is stateless and therefore does not preserve the values of the global variables between calls.

Virtual Tables

Virtual tables cannot be edited through Web services even if they are editable in Microsoft Dynamics NAV. Because each Web service operation invocation starts a new session and virtual tables are bound to that session, they can be used within the Web service operation, but they cannot be used across Web service operation invocations. Virtual tables are deleted when each Web service operation concludes.


Web service users can discover services from a server by pointing a browser or a tool such as the Web Services Discovery Tool at the computer running Microsoft Dynamics NAV Server and getting a list of available services. The general URL consists of the following elements:

  • http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/services

The URL for accessing a specific page consists of the following elements:

  • http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/Page/<ServiceName>

The URL for accessing a specific codeunit has the following elements:

  • http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/Codeunit/<ServiceName>


CompanyName, Page, Codeunit, and ServiceName are all case-sensitive.

The following table describes the elements of the URL.

URL element Description


The name of the computer running the Microsoft Dynamics NAV Business Web Services service.


The TCP port number used for the Web service. This is configured during service installation and is located in the CustomSettings.config file on the computer.

When exposing a Web service, you must open the port for other consumers of your Web service to access it. Have your system administrator add the port through Windows Firewall on the computer running Microsoft Dynamics NAV Server. The default port is set to 7047.


A name that identifies the instance of Microsoft Dynamics NAV Server. The default value is DynamicsNAV.

This matches the value of the ServerInstance parameter in CustomSettings.config, the Microsoft Dynamics NAV Server configuration file. See Configuring Microsoft Dynamics NAV Server.


The name of the company. CompanyName is optional when accessing the WSDL or calling the SystemService Web service. The company name must be included in the URL used for all other Web service calls.

Special characters in the company name must be URL encoded. For example, spaces in company names must be replaced by %20, so you would encode the company name "Microsoft France S.A." as:Microsoft%20France%20S.A.Characters that are not part of the installed language should also be replaced. For example, in a US-English locale, the company name "CRONUS ÆØÅ Company" should be encoded as:CRONUS%20%C3%86%C3%98%C3%85%20Company


The service name for the exposed page or codeunit.


A URL ending with "/" is not valid for a Microsoft Dynamics NAV Web service.

See Also


How to: Register a Web Service
How to: Use SystemService to Find Companies


Basic Page Operations
Web Services Programming Tips