Overview of Microsoft Dynamics NAV Web Services
Web services are a lightweight, industry-standard way to make application functionality available to a wide range of external systems and users. Microsoft Dynamics NAV 2013 supports creation and publishing of Microsoft Dynamics NAV functionality as web services. You can expose pages, codeunits, or queries as web services, and even enhance a page web service with an extension codeunit. When you publish Microsoft Dynamics NAV objects as web services, they are immediately available on the network.
Developers can publish two types of web services from Microsoft Dynamics NAV objects:
SOAP Web Services. You can publish either Microsoft Dynamics NAV pages or codeunits as SOAP services.
OData Web Services. You can publish either pages or queries as OData services.
Microsoft Dynamics NAV 2013 web services are stateless and do not preserve the values of global variables or single-instance codeunits between calls.
Web service protocols
The following table shows the types of web service applications you can create for the web service protocols supported in Microsoft Dynamics NAV 2013.
SOAP Web Services | OData Web Services | |
---|---|---|
Pages |
Yes: Create, Read, Update, and Delete operations (CRUD). |
Yes: Read-only. |
Codeunits |
Yes. |
No. |
Queries |
No. |
Yes: Read-only. |
See Web Service Alternatives: SOAP and OData for more on the difference between these protocols.
Page Web Services
When you expose a page as an OData web service, you can query that data to return a service metadata (EDMX) document or an AtomPub Document.
When you expose a page as a SOAP web service, you expose a default set of operations that you can use to manage common operations such as Create, Read, Update, and Delete. Page-based web services offer built-in optimistic concurrency management. Each operation call in a page-based web service is managed as a single transaction.
For SOAP services, you can also use extension codeunits to extend the default set of operations that are available on a page. Adding an extension codeunit to a page is useful if you want to perform operations other than the standard Create, Read, Update, and Delete operations. The benefit of adding an extension codeunit to a page is that you can make the web service more complete by adding operations that are logical to that service. Those operations can use the same object identification principle as the basic page operations. For an example of how to implement an extension codeunit, see Walkthrough: Creating a Web Service using Extension Codeunits (SOAP).
Codeunit Web Services
Currently available only for SOAP services, codeunit web services provide you with the most control and flexibility. When a codeunit is exposed as a web service, all functions defined in the codeunit are exposed as operations.
Query Web Services
When you expose a Microsoft Dynamics NAV query as an OData web service, you can query that data to return a service metadata (EDMX) document or an AtomPub Document. For information on how to create and use Microsoft Dynamics NAV queries, see Queries.
See Also
Tasks
How to: Publish a Web Service
How to: Use SystemService to Find Companies
Concepts
Web Service Alternatives: SOAP and OData
SOAP Web Service URIs
Basic Page Operations
Web Services Best Practices