Starting from Microsoft Dynamics NAV 2009, it was possible to publish page and codeunit objects as web services to allow external applications to access Dynamics NAV data and business logic. In the later releases of Microsoft Dynamics NAV, it is also possible to publish Query objects as web services.
Page and codeunit objects can be accessed through SOAP (Simple Object Access Protocol) web services. Queries can only be accessed through the OData web services protocol.
You will need to first enable the SOAP and OData services from the Dynamics NAV Administrator.
To publish a query as a web service from Dynamics NAV, perform the following steps:
50000
in the Object ID field.At this point, the query is already published as a web service. You can check to see if it is accessible using your browser by clicking on OData URL, and then clicking on the hyperlink symbol or copying and pasting the URL to your web browser.
Because Dynamics NAV queries can be published as web services, they can be accessed by absolutely any application that can consume OData web services. It can be an external application developed by you for the only purpose of reading Dynamics NAV data or it can be a commonly used application that supports OData web services.
If you are integrating NAV with an external app via web services, it's always recommended not to expose directly the NAV web services but use a custom WS that talks with NAV (via standard web services exposed as described) and the external system.
In this section we will see how to use Dynamics NAV queries in Microsoft Office Excel.
Among all the applications that are out there, an extensively used one is probably Microsoft Office Excel. There is a free add-in for Excel called PowerPivot that can consume OData web services.
We can do that as follows:
NAVMyQueryWS
as Friendly connection name and copy and paste the OData URL from the Dynamics NAV web service screen, or you can type in the following path as the value for Data Feed URL:
http://localhost:7048/DynamicsNAV90/OData/Company('CRONUS%20USA%2C%20Inc.')/MyQueryWS
3.141.199.243