This posts only describes how you can publish a web service in Microsoft Dynamics NAV (which is easy enough), and how you can see what you published. It does not describe how you can actually use this web service. Future posts will describe this.
Please note that the features described here are only available in NAV 2009, which is not released yet. For more details about NAV 2009, follow this link:
The short story:
In NAV 2009, run form 810 “Web Services”. Select either a page or a codeunit, then click “Publish”. The page or codeunit selected is now published as a web service.
And, a few more details:
First of all, make sure to start the service “Microsoft Dynamics NAV Business Web Services”. This is the service that handles web service requests. It runs from the same folder as the service “Microsoft Dynamics NAV Server”, which handles requests from the new client.
Then check the application log, to
1) Make sure that the service started OK
2) See what port it is listening to
Currently, the service will listen to port 7047. But this has changed and may change again, so just check the application log for an entry like this:
Service MicrosoftDynamicsNavWS is listening to requests at http://[MachineName]:7047/[InstanceName].
Open your Internet browser and go to this site:
The site name is built by taking the link from the application log (see above), and then adding /WS/[CompanyName]/Services
Note that in the comapny name, space is replaced with _ (underscore). In my case – running on a machine called TEST – the link is:
Your internet browser should now show a page like this:
It lists just one service called SystemService. The next step is to add a service from NAV:
1) Start a classic client, open Object Designer, and run form 810 “Web Services”.
2) Select Object Type = Page, Object ID = 21, Service Name = Customer Card, and tick “Published”.
Go back to your internet browser and refresh, and you should see your new service.
To see details of this service, copy the link into the address bar of your browser – in my case:
This shows you all interfaces to this service. You will notice that this web service exposes the fields from the customer card page. In addition to this, it exposes the following system functions:
These are the functions that are available on any web service which is based on a page.
As indicated by the available object types in form 810 “Web Services”, you can base a web service on either a page or on a codeunit. So just repeat the steps above, but select “Codeunit” instead of “Page” in “Object Type” in form 810 to publish a codeunit.
A web service is a method of integration based on a common framework. So a developer who knows about web services can now use your NAV webservices to develop integration without knowing anything about NAV. When using a NAV web service, it will run the same triggers as if the page or codeunit was used from a NAV client. More posts and examples will follow on this blog, about how to consume the web services that you have now published.
Lars Lohndorf-Larsen (Lohndorf)
Microsoft Dynamics UK
Microsoft Customer Service and Support (CSS) EMEA