Jaa


NAV 2009 - How to publish a web service

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:

NAV 2009 Technical Preview

 

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 https://[MachineName]:7047/[InstanceName ].

Open your Internet browser and go to this site:
https://[MachineName]:7047/InstanceName/WS/CRONUS_International_Ltd./Services
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:

https://TEST:7047/InstanceName/ws/CRONUS_International_Ltd./Services

Your internet browser should now show a page like this:

 

- <discovery xmlns="https://schemas.xmlsoap.org/disco/ " xmlns:xsi="**https://www.w3.org/2001/XMLSchema-instance**" xmlns:xsd="**https://www.w3.org/2001/XMLSchema**"\>

<contractRef ref= https://TEST:7047/InstanceName/ws/CRONUS_International_Ltd/SystemService xmlns="https://schemas.xmlsoap.org/disco/scl/ " />

</discovery>

 

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:
https://TEST:7047/InstanceName/ws/CRONUS_International_Ltd/Page/Customer_Card

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:

Read
ReadMultiple
Create
CreateMultiple
Update
UpdateMultiple
Delete

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

Microsoft Dynamics UK

Microsoft Customer Service and Support (CSS) EMEA

These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

Comments

  • Anonymous
    August 09, 2008
    PingBack from http://hoursfunnywallpaper.cn/?p=460

  • Anonymous
    August 10, 2008
    Hi Lars, I notice in your URL you have CRONUS_International_Ltd. with a full stop at the end and yet in the CTP3 release the company name has the full stop missing. Are you using a different release for your example and is this how it is going to work or was this a typo?

  • Anonymous
    August 10, 2008
    Hi, Yes, I am using a newer (internal) version than CTP3, so thanks for pointing out that CTP3 does not use the dot. How it will work in the end, we just have to wait and see ... Lars

  • Anonymous
    August 14, 2008
    This post is a step-by-step guide, how to make a very simple C# project (3 lines of code) to integrate

  • Anonymous
    August 15, 2008
    Also, if you use CTP3, then the web service will be working on a different port than 7047. So make sure to re-start the "Microsoft Dynamics NAV Business Web Services" - service, and check in the application log which port it's using.

  • Anonymous
    August 25, 2008
    This post is a step-by-step guide, how to make a very simple C# project (3 lines of code) to integrate

  • Anonymous
    September 07, 2011
    Hello, i'm looking for the way to publish a page using the MultiLanguage OptionStrings values not the OptionValues of the page field. Do you know the way?? Best regards from spain