When developing extensions, you may need to automatically publish a Dynamics 365 Business Central object as a web service instance for external applications.
There are essentially two different ways to automate this process:
- Create an Install codeunit and, in this codeunit, create the web service instance by inserting a record in the Tenant Web Service table via AL code.
- Create an XML file with a TenantWebService definition.
With the first method, you define an Install codeunit, and (for example, in the OnInstallAppPerCompany trigger) you can create the web service definition by creating a new entry in the Tenant Web Service table, as follows:
codeunit 50104 TestInstallCodeunit
Subtype = Install;