How to Publish MS Dynamics NAV Page as Web service?

MS Dynamics NAV by default does not provide any web service there again it allows an easy process to create, publish and consume a Page as web service.

In this blog I will show, how to register and publish a Dynamics NAV Page as web service, which can be easily consumed from other applications.

In Dynamics NAV 2009 and 2009 R2 you are advised to install Dynamics NAV RTC client to work with web services as in these versions of Dynamics RTC client is optional. Later version of Dynamics NAV 2009 R2 does not provide classic client and we have only option of RTC client.

I am going to register/publish Customer Card as web service. ID of Customer Card Page is 21.

To register a Page as web service we need to open RTC client and connect to company, for demo purpose here I am using demo company CRONUS India Ltd.

After opening RTC client follow any one step to open Web Service registration window.

Method 1:

On the left side of the screen there is navigation pane, first click Departments, then click Administration, after that click IT Administration, then click General, and finally click Web Services.

Method 2:

I simply like this method the most, firstly, write Web Service in Search Box (you can find it top right corner) and click on Web Services.

And Web service window will be opened as the image displayed below.

We can see Dynamics NAV does not provide any web service by default.

To register a Customer Card as Web Service click on ‘New Button’ in Web Services window (Marked in red arrow in the above shown image).

In New Window we can find four columns which we need to fill to register and publish a web service:

  • Object Type: Select ‘Page’
  • Object ID: Write ‘21’ (21 is ID of the Customer Card)
  • Service Name: Here you can specify what you like. I have written as ‘CustomerCardPageService’
  • Published: ‘Check On’ this column to publish my brand new web service.

Then click OK button to close the window.

Here we have done our first brand new Web Service named as CustomerCardPageService.

To verify my web service is working or not we can check the WSDL in browser.

Format of URL is supposed to be like this:

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

You can find the above keys and its values in your CustomSettings.config file. Please replace those values.

For Demo purpose:

My URL is: http://localhost:7047/DynamicsNAV70/WS/CRONUS%20India%20Ltd./services

Now, you can see CustomerCardPageService in Company Services and the URL is

http://localhost:7047/DynamicsNAV70/WS/CRONUS%20India%20Ltd/Page/CustomerCardPageService

You can copy the above url in address bar of the browser, which will open the WSDL of my new Web services as below:

This service URL can be consumed by any other application written in .NET, JAVA, PHP etc.

In the same way User defined Custom Pages can also be published and consumed.