Web Services in Dynamics NAV

6/10/2015 Carsten Howitz Dynamics NAV

Web Services in Dynamics NAV

You may have heard of Web Services before and maybe also in conjunction with Dynamics NAV, but what exactly is a web service and how does it work with Dynamics NAV?

What is a Web Service?

Let’s say you want to see a map of where you live. You could go to maps.google.com and type in your home address and you would almost instantly see a nice map of your hometown and your exact address. What if you instead wanted to write a software program that would take an address and show a pretty map? Well, instead of trying to create a new mapping program from scratch, you could use a web service from Google and write software that would provide an address and ask the web service for a map in return. That would save you a lot of time not having to reinvent what Google already made available.

A web service is a function or several functions that are hosted in the cloud (on the Internet). Usually the web service will access, modify, or insert data of some kind, like the mapping information mentioned above, where we provide an address and we get a nice map back. In business applications, web services often access customers, products, price lists, or employee information just to mention some examples.

The great thing about web services is that we don’t need to know anything about the underlying code or database technology. So we can write software on a Mac, iPhone, Android, or Windows PC that access, write, or modify data from a web service that gets its data from a Microsoft SQL server. One day the web service could change the database to Oracle, but from the outside world the web service still looks exactly the same to the software programs. So the web service provides an interface to something that we don’t have to worry about or even fully understand. We just need to know how the interface looks like and what inputs the service are expecting and what outputs we can expect back.

Web Services inside Dynamics NAV

Dynamics NAV has been able to provide access to functionality and data inside NAV via web services since its 2009 version. Pages and Codeunits can be exposed as web services just by entering them inside the Web Service table and check the Publish box.

Let’s say you have someone build you an e-commerce website so you can sell your products online. In order to provide the products information to the web developer, you could simply enter your Item Page into the Web Service table and the web site would have access to you inventory master to get all the needed information on the website. What’s even better is that any update you provide to your products would be instantly accessible to the website. What’s great about this is that the web developer doesn’t have to know anything about Dynamics NAV, they can just access all the data directly from the web service.

Navigation

Social Media