THE COLLEGE OF INFORMATICS AND VIRTUAL EDUCATION
(CIVE)
DEPARTMENT: INFORMATION SYSTEMS AND TECHNOLOGY.
COURSE CODE: CP 311
COURSE NAME: INTERNET PROGRAMMING AND APPLICATION II
PROGRAM: BSC-IS
STUDENT NAME:
NZUNGU ENOS PANTALEO
REGISTRATION NUMBER: T21-03-11970
INDIVIDUAL ASSIGNMENT
QN: Why SOAP or Why REST. Which is the best between the two.
SOAP and REST are two internet data exchange mechanisms. Example once a manager account
system share data with the customer account system to automate the invoicing tasks. The two
application share data by using an API that define the communication rule
WHY USE SOAP?
SOAP (Simple Object Access Protocol) can be used to express complex methods in a more easily
understandable format. This is especially beneficial for large enterprise environments where
there may be a lot of different applications or systems that need to communicate with each other.
These are some of the most common use cases for SOAP API. However, there are many other
use cases as well. You can even use SOAP API to build your own web services. The possibilities
are endless
First, SOAP requires an additional layer of WS-Security to work with HTTPS. WS-
Security uses additional header content to ensure only the designated process in the
specified server reads the SOAP message content. This adds extra layer of security to data
exchanged especially in the message header.
Built-in error handling, SOAP includes mechanisms for defining detailed error messages
and handling faults, which can be helpful for applications which requires robust error
handling and fault tolerance.
SOAP can be useful for stateful operations, as it offers a WS structure. This happens in
scenarios where you have to make a chain of operations act as one transaction example,
in the case of bank transfers.
SOAP can be useful for asynchronous processing and subsequent invocation, as it offers
extra features that can help establish a robust security framework.
SOAP can be useful for formal means of communication, as it offers rigid specifications."
Legacy system support is another frequent case for using SOAP. Popular web services
that have been around for a while might have many users who still connect to their
services through their existing SOAP API, if you need to integrate or extend legacy
systems that already have SOAP APIs, you may be better off continuing with SOAP.
WHY USE REST?
REST is a web service that uses HTTP requests to GET, PUT, POST, and DELETE data.
A REST API can be used to access resources such as text files, images, and videos. A
REST API can also be used to access data from a database. A REST is different from a
SOAP. A SOAP uses XML to define the structure of the data being exchanged. A REST
uses JSON to define the structure of the data being exchanged. A REST is lightweight
and easy to use. It is also easy to scale;
The REST architecture allows API providers to deliver data in multiple formats such as
plain text, HTML, XML, YAML, and JSON, which is one of its most loved features.
Hence you can use any of formats to send data to server or client, though JSON is mostly
used as it more lightweight and less verbose format, and it’s easier to read and write as
well and can be used with any programming language.
REST is scalable, REST permits stateless and layered architecture, which makes it more
scalable. For example, the application server can pass the request to other servers or allow
an intermediary (like a content delivery network) to handle it.
REST can leverage HTTP caching mechanisms, which help improving performance and
reduce server load by allowing clients to cache responses.
REST is simple to use and design, as RESTful APIs can make requests via a simple URL
and use standard HTTP methods(GET, POST, PUT, DELETE) and utilize data
lightweight formats such as JSON.
Before choosing between SOAP and REST, consider your scenarios and your API users'
requirements. To decide whether to use SOAP vs REST for your web service, you’ll need
to take the following factors into consideration such as:
knowledge of your team of developers whether they know REST APIs or SOAP
State, if you need to develop statelessness operations use REST APIs and for stateful
operations use SOAP.
Security, if you need to transfer highly sensitive data such as bank transfers use SOAP,
otherwise use REST.
Overall application design, Modern applications like mobile apps and hybrid applications
work better with REST APIs. However, if you need to integrate or extend legacy systems
that already have SOAP APIs, you may be better off continuing with SOAP.
To conclude SOAP vs REST, web service developers usually prefer a RESTful architecture
unless SOAP is concretely the wiser decision. This can be the case for enterprise apps that
require more resources and have more complex security requirements. RESTful web services are
typically more lightweight, making them ideal for apps that need to run on mobile devices or
other resource-constrained devices