Search code examples
restweb-servicessoapodatasap-gateway

What is the difference between SOAP web-services and an OData service?


I already built different SOAP webservices in java (years ago..) and different OData Services with the SAP Gateway in abap. The major difference (except of the programming language) is that I recieve a WSDL (likely XML) with a SOAP-webservice- with OData I can choose between a xml or json output.

Both realize/implements the REST-Paradigm, but mostly its common to implement an OData-Service. I know that any different software can consume OData easily- but where are the advantages and disadvantages between both services? I don't really get it.


Solution

  • They share that they have a model and you can ask the model what it can do and you can use it to exchange data.

    The difference:

    SOAP is by far more flexible. You can model anything. This comes with some complexity. It lets you exchange any data between servers or between servers and complex clients.

    This flexibility makes SOAP complex to be consumed in web browsers.

    The idea behind OData is to severely restrict what you can model to make it easy to be consumed in JavaScript:

    Basically it models flat tables with methods to insert, update, delete, list. You can have multiple of those tables in an OData service and you can define a hierarchy.

    Think of a list of customers and orders per customer.

    (OData can do a little bit more but lets keep it simple)

    All that is made in a way that it can be easily consumed by JavaScript.

    OData also standardizes a few things that are useful for web apps.

    Now have a look at SAP Fiori: The simple data model of OData matches what those simple Fiori apps can show at a time.

    Hope this gives you a good overview picture:

    SOAP for data exchange, OData for web applications.