Business Central how to invoke a Web Service from Powershell

Business Central how to invoke a Web Service from Powershell

How-to re-call a WebService from Powershell (BC On-Premise)


We already have Web Services defined, with several fields calculated or recovering difficult management data (e.g. dimensions shortcuts etc.), the Web Services are ready and we want to reuse them.

We don’t want to redo them, we don’t want to create APIs or create other external procedures to read them, for example, we want to read them to feed tables in a datawarehouse without using SQL Server (through stored procedures the functions).

One possibility is to recall them from powershell, there are some ways to do it.

Remember: calculated fields are NOT seen in SQL Server, in Web Services yes; Powershell and Sql Server are not available for BC Cloud

#1 – Publish a Web Service on Business Central

Example “ItemListWs” Web Service, publish SOAP & Odata Web Services

Example WS Link


#2 – Use Powershell to re-call Web Services


Module: Microsoft.PowerShell.Utility – “Gets content from a web page on the internet

You can pipe the body of a web request to Invoke-WebRequest

The Invoke-WebRequest cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of links, images, and other significant HTML elements.

Beginning in PowerShell 7.0, Invoke-WebRequest supports proxy configuration defined by environment variables.

Microsoft Example




Module: Microsoft.PowerShell.Utility – “Sends an HTTP or HTTPS request to a RESTful web service”

You can pipe the body of a web request to Invoke-RestMethod

The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that return richly structured data.

PowerShell formats the response based to the data type. For an RSS or ATOM feed, PowerShell returns the Item or Entry XML nodes. For JavaScript Object Notation (JSON) or XML, PowerShell converts, or deserializes, the content into objects.


Microsoft Docs



One thought on “Business Central how to invoke a Web Service from Powershell

  • 30 July 2020 at 11:10 AM

    As a mule developer, I have used a consumer component or SOAP web application for the WSDL file. this business central new to me but the terminology is relevant to me will book bark this blog for my future references


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.