Define differences between SOAP, OData, REST, and API

Completed

Simple Object Access Protocol, or SOAP, is a messaging protocol that is based on XML. It allows different (remote) processes to communicate. SOAP relies on HTTP(S), SMTP, or FTP for message negotiation and transmission. The SOAP protocol isn't easy to work with.

The most common type of messaging pattern in SOAP is the Remote Procedure Call (RPC), where one network node (the client) sends a request message to another node (the server), and the server sends a response message to the client. RPC uses SOAP envelope, which defines the message structure and how to process it.

To work with SOAP, the client that connects to the Business Central server must be able to understand SOAP messages. In the .NET Framework, SOAP services have been supported since the release of Windows Communication Framework (WCF) in version 3.0.

A SOAP service exposes a Web Services Description Language (WSDL) file that describes how the service can be called, what parameters it expects, and what data structure it returns. This file is an XML-based document and is targeted to be read by machines, not by humans.

Business Central also supports Open Data Protocol, or OData, which is also an open protocol that is designed to use and query RESTful APIs. An API is a set of routines and protocols that are used to communicate between different software components. APIs have been used for many years, and almost all software had an API that allowed other programs to use some functionality of the software. The Win32 library, for example, is a well-known Windows API that is used to run older applications on newer versions of Windows.

Currently, APIs are used most often in web applications. Every large web application like Facebook, LinkedIn, Microsoft Graph, and so on, offers the possibility to connect by using APIs to enhance the experience of the web application or to use data that is provided by the web application. If these APIs follow the REST architecture, then they are referred to as RESTful APIs. REST is an architecture for web services that can function at internet scale, meaning that they can handle many connections and requests from around the web. These services are stateless, which means that you can request some data from the server and the server replies but doesn't keep an internal state or session about the request. The server closes the connection after the reply.

These transfers can only happen over HTTP(S), and REST has support for JSON and XML. However, JSON is the most used format in combination with REST services.

The significant advantage of REST is the way that you can call REST services. To make these calls, you can use a URL that uses standard HTTP verbs like GET, POST, PUT, and DELETE. Every programming language that is capable of sending HTTP requests can work with REST services, which results in a much higher performance and scalability than SOAP. Additionally, because it's an HTTP request, browsers or the server can cache responses.

OData is built on REST services and can be used to query REST services. For example, by providing extra query parameters to a URL, you can limit or filter the result set. OData is simple to use for CRUD operations. Where SOAP exposes a WSDL document, OData exposes an EDMX document, which contains metadata for all published web services.

OData uses different formats for representing data and the data model. JSON format is the standard, but the Atom format is also available with OData. Atom is also an XML-based format that is used for web feeds (like news feeds). The EDMX document is created as an XML document, so OData uses a combination of different file formats.