NAV 2009 Web Services (Part 3 – finally a web service!)

Up to this point we have been preparing the structures needed to support our application. We have created the traditional simple tables and forms, as well as gone through the process of generating some pages equivalent to those forms. The entire reason for the latter work was that it is only possible to expose pages or codeunits via web services.

Thankfully the task of registering and publishing a web service from within NAV is a very, very simple affair.

From within the Classic client navigate to, and run form 810 – Web Service.

Our first task is simply going to be to get a list of Vehicle records out of NAV. In order to do this we will need to expose our Vehicle List page (in my case this is page 50002).

To do this we simply select the Object Type = Page, enter the Object ID = 50002; give the service a name = Vehicle, and tick the published flag.

Next we need to make sure that the NAV Web Service service is actually running. This can be done by checking the services.msc for your machine.

In my case I have created a second set of middle tier services (thanks to FreddyK and the following posting: http://blogs.msdn.com/freddyk/archive/2008/10/29/multiple-service-tiers.aspx ), but the one I am interested in here is the highlighted web services – DEV service. As we can see this is running as required.

So how do I make sure that something is actually being exposed before we look at consuming the web service (in the next post)? The answer is that we must verify our web service availability. We do this by navigating to the following URL in our web browser of choice:

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

NOTE: The company name is optional and case-sensitive and the rest of the values can be found in your CustomSettings.config file.

In my case this converts to: http://localhost:7047/Dev/WS/services

Success!!!! The Vehicle page has been published and is exposing itself via the port specified.

Next time we actually get to something where I really am going to start to learn as I go – we will try to write an application in C# to retrieve our data via the web service. As I've mentioned a few times, and as the Microsoft Statement of Direction (see: http://dynamicsuser.net/blogs/admin/archive/2009/05/21/what-is-the-plan-with-microsoft-dynamics-nav-until-2017.aspx ) mentions we are moving more and more towards using a .NET programming environment so I need to make sure that I am familiar with this environment as soon as possible. I see the current touch point as the web services so getting familiar with these and exploring exactly how to interact with and consume them is where my current focus is.

Comment List
  • As a new NAV 2009 developer, I was reading your post with much interest. However, the bit that would have interested me most is the web service consumption as my intention is to expose the customer card page and use that via a web service.

    Using part 3 of your very comprehensive guide, I've got it exposed very easily but I can't find part 4 anywhere. Has it been released yet?

    Thanks,

    David.

    davew7771@hotmail.com

  • Hi David,

    Sorry - part 4 is not done yet.  Been very busy in my day job, but hope to put something up in a couple of weeks.

    Regards

    Ryan

  • Hey Ryan,

    It's now been 6 months -when is part 4 going to get published?

    Erik

Related
Recommended