D365 Business Central : Publish Web Services Automatically from the App

I recently needed to publish web services from an app and realised I haven’t blogged about it yet. Here’s a quick post on auto publishing web services when deploying your app.

Create XML File

To get started, you need to create an XML file in VS Code. In this example, let’s call it MyWebService.xml.

The good news is we have Waldo’s snippet to help us create the XML. Let’s choose the twebservicecollectionwaldo snippet to help generate multiple web services.

Web Service Snippet
TenantWebServiceCollection

You’ll need to configure the following:

  • ObjectType
  • ObjectID
  • ServiceName
  • Published (true for automatic publishing or false for manual publishing).
Examples

Publish the App

Web Service List

When you publish your app, the web service is automatically installed. Likewise, when you unpublish the app, the web service is automatically removed.

That’s it! Nice and easy.

I hope you find this useful.

<?xml version="1.0" encoding="utf-8"?>
<ExportedData>
    <TenantWebServiceCollection>
        <TenantWebService>
            <ObjectType>Page</ObjectType>
            <ObjectID>7</ObjectID>
            <ServiceName>MyPriceGroups</ServiceName>
            <Published>true</Published>
        </TenantWebService>
        <TenantWebService>
            <ObjectType>Page</ObjectType>
            <ObjectID>11</ObjectID>
            <ServiceName>MyShipmentMethods</ServiceName>
            <Published>false</Published>
        </TenantWebService>
        <TenantWebService>
            <ObjectType>Page</ObjectType>
            <ObjectID>15</ObjectID>
            <ServiceName>MyLocations</ServiceName>
            <Published>true</Published>
        </TenantWebService>
    </TenantWebServiceCollection>
</ExportedData>

thatnavguy

Experienced NZ-based NAV Developer and Consultant with 15+ years of experience leading multiple IT projects, performing business analyst, developing, implementing, and upgrading Dynamics NAV and Business Central. Passionate to deliver solution that focuses on user-friendly interface while keeping high standard of compliance with the needs.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *