Learnitweb

Service-oriented architecture

1. Introduction

Service-oriented architecture (SOA) is a method of software development that uses software components called services to create business applications. Each service provides a business capability. Services can communicate with each other across platforms and languages. Services are reusable and can be used in different systems or can be combined to perform complex tasks.

For example, there can be multiple business functions which require authentication functionality. This functionality can be developed as an authentication service and reused across business functions rather than creating for each business function separately.

service-oriented architecture

2. Benefits of service-oriented architecture

  • Faster to introduce new features in application: Services can be reused in service-oriented architecture. So it is easier and faster to build applications in service-oriented architecture. New services can be developed separately, so developers can introduce new features without affecting other parts of the application.
  • Low maintenance: It’s easier to create, update, and debug small services than large code base in monolithic applications. Modifying a service in SOA does not impact overall functionality of the application.
  • Easy to introduce new technology: New services can be developed using new framework and languages. It is easy to change or rewrite a small service code using new language or framework.

3. Basic principles of service-oriented architecture

There are no well-defined standard guidelines for implementing service-oriented architecture (SOA). However, there are some common principles across all SOA implementations:

  • Interoperability: Each service in SOA provides documentation which specify the functionality of the service, the input for the service and the response format. Any client system can invoke the service. Also, one service is separate from the another and therefore change in one service will not significantly impact other application.
  • Loose coupling: Services in SOA should be loosely coupled, having least possible dependency on external resources or systems. Service in SOA should be stateless, that is service should not retain any information from past session or transaction. When services are loosely coupled then change in one service does not significantly impact other service and application.
  • Abstraction: Consumers of the service does not know the implementation details of the service or service’s code and logic. Consumers of the service know how to run the service and that is enough for a consumer.
  • Granularity: Each service in SOA represents a business function. Two or more business functions should not be served by a single service. Each service in SOA is of appropriate size and does not represent a huge business function. Multiple simple services can be combined to create a service serving complex business logic.

4. Components of service-oriented architecture

There are four main components of service-oriented architecture:

  • Service
  • Service provider
  • Service consumer
  • Service registry

Service

Services are the basic building blocks of service-oriented architecture. Each service has three main features:

  • Service contract: The service contract defines the terms and conditions of the service, such as prerequisite for using the service, service cost and quality of the service.
  • Service interface: In SOA, service consumers communicate with a service through service interface. The interface defines how to invoke a service. Service interface abstracts the service implementation to the consumer.
  • Service implementation: Service implementation is the code of which a service is made.

Service provider

The service provider creates, maintains, and provides one or more services that consumers or clients can use. Organizations can create their own services or can use services provided by other service providers.

Service consumer

The service consumer is the one which requests the service provider to run a service. Service providers and consumers follow the service contract to communicate with each other.

Service Registry

A service registry, or service repository, is a network-accessible directory of available services. Service registry stores service description documents from service providers. The service description document contains information about how to communicate with a service. Service registry is used by service consumers to discover the services.

5. Communication protocols

Services communicate over the network using established protocols. Some standard protocols to implement SOA are:

  • Simple Object Access Protocol (SOAP)
  • RESTful HTTP
  • Java Message Service (JMS)
  • Apache ActiveMQ

6. What is an ESB in service-oriented architecture?

An enterprise service bus (ESB) is software that you can be used to communicate with a system which provides multiple services. ESB establishes the communication between a service consumer and a service provider.

An ESB can be used as a router service that routes service requests to appropriate service. ESB can transform the request into a format that is acceptable to the service provider. This enables the service consumer to run a service written in different technology and framework.

7. Limitations of service-oriented architecture

  • Single point of failure: In service-oriented architecture, ESB acts as a single point of failure. Services can not interact if ESB goes down.
  • Limited scalability: It is difficult to scale services when service has dependency on external resources.
  • Complexity: Service-oriented architecture become complex over time when dependency increases between services.

8. Conclusion

In this article, we discussed service-oriented architecture. In upcoming tutorials, we’ll move to microservices