Services in SOA
Services are the basic building blocks in a Service Oriented Architecture (SOA). This article examines services in SOA more closely by describing the key characteristics of services in SOA, discussing the different types of services in SOA, and explaining where services reside in the different SOA layers.
What is a service in SOA?
A service is a self-contained unit of software that performs a specific task. It has three components: an interface, a contract, and implementation. The interface defines how a service provider will perform requests from a service consumer, the contract defines how the service provider and the service consumer should interact, and the implementation is the actual service code itself. Because the interface of a service is separate from its implementation, a service provider can execute a request without the service consumer knowing how it does so; the service consumer only worries about consuming services.
In a service oriented architecture, services can be combined with other available services in a network through service orchestration to create higher-level composite services and applications. A service is reusable, non-context specific, stateless, and can be dynamically discovered across the enterprise, in partner systems, or in the cloud. These characteristics enable services to be loosely coupled, resulting in new applications that are designed according to SOA principles.
Services can be derived from existing IT assets or created from the ground up by writing new code. In the former approach, also known as service enabling, business logic, data, and other existing assets in legacy systems are transformed into services, which can then be invoked by other services to create composite services and applications. Enterprises looking to implement SOA should ideally begin by leveraging their existing assets to create services, but developing new services from scratch is sometimes required in particular circumstances.
An important point to bear in mind when creating a service in SOA is granularity. A course-grained service includes more functionality (i.e. more operations) than a fine-grained service, which includes less functionality (i.e. fewer operations). The granularity of a service will vary depending on its purpose, but a poorly grained service results in low reuse possibilities and the misalignment of enterprise systems with business objectives.
Types of services in SOA
There are several types of services in SOA, which are divided into two categories: Business Services and Infrastructure Services.
Business Services are services that perform specific business functions and are required for the successful completion of a business process. They might also be called Application Services since they are used to develop composite services and business applications that automate business processes. For example, a retail enterprise might have an “Inventory Service,” “Customer Management Service,” and “Shipping Service” in its repository of business services.
Business Services can be further divided into Entity Services, Capability Services, Activity Services, and Process Services. Entity Services are the data-centric components of the enterprise system and are responsible for exposing the information stored in backend databases. They can be thought of as the “nouns” of the business process. Capability Services and Activity Services, meanwhile, are the “verbs.” They are the action-centric components that implement business capabilities. Whereas Capability Services are coarse-grained and provide generic business capabilities, whereas activity services are more fine-grained and provide more specific business capability. Rounding out the business services category are Process Services, which contain the business logic and couple the Entity Services and Activity and Capability Services via service orchestration to create composite business services.
The other main category of services is Infrastructure Services, which are part of a centrally managed infrastructure component such as an Enterprise Service Bus (ESB). Infrastructure Services provide the technical functionality necessary for the implementation of business processes in SOA, but do not directly add business value. Examples of Infrastructure Services include SaaS Integration Services, Authentication Services, Event Logging Services, and Exception Handling Services.
Infrastructure Services are further divided into Communication Services and Utility Services. Communication Services are mainly concerned with transporting messages both within and without the enterprise while Utility Services provide other technical capabilities not related to message transfer.
Although there are several approaches to categorizing the different types of services in SOA, the main distinction to remember is the one between Business Services and Infrastructure Services. Infrastructure Services are agnostic and have greater reuse possibilities while Business Services directly translate into business processes. The reuse possibilities of Business Services will vary depending on how they are designed.
Services in SOA layers
To get a better sense of the role of services in SOA, you can think of SOA in terms of abstract layers:
Enterprise Layer
Process Layer
Service Layer
Component Layer
Object Layer
The first layer, the Object Layer sits at the bottom and consists of legacy systems, including custom-built applications and databases that contain business functionalities. These legacy enterprise objects can be leveraged to build composite services - proof that SOA doesn’t have to mean rip and replace. Just above the Object Layer is the Component Layer consisting of enterprise components. These components are responsible for realizing the functionality of services.
The middle layer is the Service Layer, which is where exposed services (both individual and composite services) carrying out business functions reside. The Service Layer acts as a bridge between the lower-level layers (the Object Layer and Component Layer) and the higher-level layers (the Process Layer and Enterprise Layer). Enterprise components can be exposed as services in this layer, making reuse a real possibility.
Next is the Process Layer. Here, the services exposed in the Service Layer are combined through service orchestration or service choreography to create a single application that realizes and automates a business process. The final layer is the Enterprise Layer (also known as a Presentation Layer), which is the end-user’s point of access to the composite enterprise application, typically over the Internet.
As the layered abstraction above makes clear, services play a fundamental role in SOA. For enterprises facing integration challenges and looking to increase business agility in meeting customer demands and to cut IT costs, SOA doesn’t have to be difficult to understand. As long as business leaders understand what services are (and their different types) and how each layer contributes to building new applications, SOA becomes less foreign as a concept and instead becomes a mission-critical IT goal waiting to be realized.
Ready to get started? Explore MuleSoft's solutions for SOA.