SOA (Service Oriented Architecture) Testing

Learn via video courses
Topics Covered

Overview

All the recent applications are now built on Service-Oriented Architecture where there are multiple components, and all are independent of each other and autonomous. They are called a service in the application. , For example,, on booking sites, there are multiple services-login, messaging, mailers, etc.

What is Service-Oriented Architecture (SOA)?

Service-oriented Architecture is an application design approach where the entire software is built using reusable service components. A service is a unit of software functionality designed for a specific task. It contains the code for data and also integration into the other components. SOA is different from microservices even though they both serve similar purposes, as microservices are composed of loosely coupled, reusable components that often work independently.

Service Oriented Architecture vs. Microservices

CriteriaService Oriented ArchitectureMicroservices
ScopeSOA has an enterprise level scopeMicroservices have an application level scope
ReusePrimary goal of SOA is to have reusable componentsMicroservices components reuse code by improving decoupling.
Synchronous CallsSOA application works on synchronous calls of the servicesWithin a microservice, asynchronous calls are made.
Data DuplicationIn SOA, services are called to directly update the primary dataEach microservice has access to all the data here.
StorageSingle data source shared by all the services within the application.Microservices an entire server for any service that needs it.

Major roles within Service-Oriented Architecture

Major roles within Service-Oriented Architecture

There are two major roles within a service-oriented architecture:

1. Service provider: The service provider is the organization that has built the service and is maintaining it. They have a paid subscription model maintained and documentation on the data limits of the service and how to use it. For instance, Google provides Google Maps Service, which is used by the applications like Uber, Ola Cabs, Zomato, Swiggy, etc.

2. Service consumer: The applications which call the service into their application and complete the product workflows. They use the data provided by the providers and apply them to find net profits, gains, and other business values. For example, from the data obtained by Zomato, Zomato plats more employees where the request is more. All this Zomato does is by collecting data obtained in their application.

Components of SOA

Components of SOA

Objectives of SOA

  1. SOA lets developers maintain an agile model where applications are developed from reusable service interfaces.
  2. SOA lets developers take the assembled functionality and reuse it into an entirely different application setup.
  3. SOA has better collaboration with the IT and the business team as a component can be named here, like messaging, etc.
  4. Each service is a complete business functionality and application in itself, with instructions on how to integrate.

Implementation

SOA is implemented with web services such as hypertext transfer protocol(HTTP) and a server like Node.JS or .NET server. Services can be created in any language like .js, .net, .java, or python. They have to be able to take requests from the browser and reflect the response to the client with the data from the database(if required).

Services have to capture requests and send back the response. Apart from that, all the process is done, which can include some calculation, data filtering, and sending and getting data from the database.

Guiding Principles of SOA

1. Loose Coupling: Loose coupling means that dependency on other services is minimized as services are created as independent components in themselves.
2. Reusability: Services are created as reusable components that could be used in the same application or even in an entirely different setup.
3. Autonomy: Services use encapsulation where there is no need to know about the code from the consumer's point of use. The consumer attaches the service to the application to complete the workflow.
4. Abstraction: Services hide the logic. Only the integration is known to the consumer for service. Name, parameters to pass, and return type are the only known parts.
5. Composability: Using these individual components, one can create an entire workflow. These services are building blocks, and complex operations can be operated using the same.

Example of Service-Oriented Architecture

Let's take the Zomato application to understand Service Oriented architecture. Here will consider the Zomato Android application. The user has logged into Zomoto already. The user goes to the home page and clicks on search. The user types in pizza and presses enter. A list of nearby Pizza restaurants comes up.

Let's discuss only this part. Zomato application is using your geolocation via MAPs which you have earlier allowed. The moment you press enter, your search keyword and location coordinate hit up the API. Now during the process of typing, you were getting autosuggestions that were also via the Google Search service which the app was using. The data goes to the service, and from the database, nearby ten results are sent as a response to the UI, which are displayed beautifully on the UI. This is how services are built and called during the entire workflow. Zomato must be using hundreds of web services.

Advantages and Disadvantages of SOA

Advantages of SOA

  1. SOA applications are highly scalable. As all the components are independent and loosely coupled.
  2. Reusability is the primary advantage of SOA as services can be called N number of times.
  3. Easy maintenance, as any new code or code removal won't affect these independent service components.
  4. Availability as services are available on request.

Disadvantages of SOA

  1. Initial time investment to design the architecture is more as an entire framework had to be laid down.
  2. Cost is also on the higher end as a server must be up and running at all times, independent of the UI engine.
  3. Security investment is also high, so unauthorized penetration cannot happen.
  4. Investment in unit testing as automation scripts would test the individual components.

Conclusion

  1. Service Oriented Architecture(SOA) is a design pattern approach to building an application.
  2. Services are loosely coupled, independent components which promote code reusability.
  3. There are 2 types of roles in SOA - one is consumer service, and the other is provider service.
  4. SOA is high on cost and time investment but offers a code-maintainable approach.