One of the biggest improvements in the future NAV 2009 three-tier platform will be the possibility to run a NAV object (a table or a codeunit for example) as an XML web service. The final result is that you will have a platform ready to be extended and integrated with external systems. The biggest news is that now you can invoke the NAV logic also from the external world... this is fantastic and extremely powerful for every type of integration.
Directly from the NAV Developer Team, a brief explanation:
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 company 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:
- <discovery xmlns="http://schemas.xmlsoap.org/disco/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<contractRef ref=http://TEST:7047/InstanceName/ws/CRONUS_International_Ltd/SystemService xmlns="http://schemas.xmlsoap.org/disco/scl/" />
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.
Technorati Tag: Dynamics NAV