Create Web service In Business Central

 Web service in Business Central

In Business Central, web services are used to expose the functionality of the system to external applications over the internet. This allows other applications to access and manipulate data in Business Central, and to perform tasks such as creating new customers, posting sales invoices, and more.

There are two types of web services in Business Central: SOAP and OData.

SOAP (Simple Object Access Protocol) web services are based on the standard web services protocol and are primarily used for integration with older systems that do not support OData.

OData (Open Data Protocol) web services are based on the OData standard, which is a more modern protocol for accessing and manipulating data over the web. OData web services provide a more efficient and flexible way to access data in Business Central, and are the recommended option for integration with newer systems.

To create and expose a web service in Business Central, you will need to use the development environment to create a new web service and define the operations that it will perform. Once the web service is created, it can be published to a web server, and the URLs for the web service can be shared with external applications.

In addition to creating custom web services, you can also use the built-in web services that come with Business Central such as the OData v4 web service, which provides access to data in Business Central through a standard OData endpoint.

It’s important to note that web services can be a security risk if not properly secured, so you should make sure that you follow best practices for securing web services, such as using secure connections and authentication.

There are three ways to publish Web service as Page, Codeunit, Query , To Publish them Object ID used as for Codeunit- 5, Page – 8, Query 9.

Codeunit and Page are valid types for SOAP web services. Page and Query are valid types for OData web services.

Example                                                            

Publishing Web Series as Page

– Customizing web service from Sales Header Table using AL Language.

– Creating a List page for “Sales Order Web Service”.

Creating an XML file for Web Service

To Publish a web service

  1. Run a Code and Open Business Central.
  2. In the Business Central, in the Search box, enter Web Services, and then choose the related link.
  3. In the Web Services page, choose New.
  4. In the Object Type column, select Codeunit, Page, or Query.
  5. In the Object ID column, select the object ID of the object that you want to expose. For example, 50111 Which we have Created.
  6. In the Service Name field, assign a name to the web service. For example, if you expose the customer card as a web service, enter Customers.

7. Select the check box in the Published

8. When you publish the web service, you see the URLs that are generated for the web service in the OData URL and SOAP URL You       can test the web service immediately by choosing the links in the OData URL and SOAP URL fields.

To Check the availability of a web service

  1. Click On the URL which is in Soap and OData URL.
  2. After click on URL Link it will asl for Username and Password, In the Business central Search for Users Page then click on relevant link.
  3. For the Username enter your Username from Users page , And for Password enter your Authentication key.
  4. After Click on Sign In It will show you an your Web service Data in Business Central.

Pooja Zinjurke 

Technical Consultant – D365 BC 

Addend Analytics

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.