What Is SOA?

From Misc

SOA stands for Service-Oriented Architecture.

It is the reliance on web services to send and receive data. The services are loosely coupled, meaning any client on any platform can connect to any service as long as the essential contracts are met.

Clients can consume multiple services, and services can have multiple clients.

From Plural Sight

The decomposition of a system into autonomous (or nearly autonomous) units of responsibility, and exposure of those units in a secure and controlled fasion.

Exposure of an API for your system.
The client has limited functionality access.
Clients access functionality by making service calls.

SOA Vs OOP

Comparison from the client side:
- OOP is when you use a library. You have access to all the individual objects. You need a lot of knowledge about how to use the objects together, what order to run operations in, etc.
- SOA abstracts all those details away, only exposing high-level operations that always leave the application in a valid state (i.e. they are stateless because state does not have to be maintained between calls).

Comparison from the application side:
- OOP is concerned with the lower-level design decisions.
- SOA is concerned with the higher-level design decisions.

Rough Definitions

Loosely Coupled Services

Services that communicate with the client or with each other using a set of industry-accepted standards and protocols.

Service

A service is a collection of operations (units of responsibility).
The service is the point of entry for the client.
Services are secure. (They handle any required internal security. They also inherently limit client access to their system.)
Service operations always leave the system in a consistent (valid) state.
Services handle faults/exceptions gracefully.
The client is not exposed to any details of how an operation is fulfilled.
The client is protected from code volatility (likelihood of change).
Service calls are (almost always) stateless.

A service is a logical representation of a repeatable business activity with a specific outcome. It is self-contained. It is a black box to programs that consume it.

A service can be composed of several other services.

Service Oriented Application

An application whose volatile areas are abstracted, or wrapped, in a simple service call that is exposed to the client.

Each service call is called an "operation".

Transaction

A set of actions that must all succeed together or all fail together.
Don Box's 4 Tenets Of SOA

Boundaries Are Explicit

Services interact by sending messages across boundaries. The boundaries are formal and explicit. No assumption is made about what is behind the boundary.

Ex: the client does not know what kind of database or file system the service is using.

Services Are Autonomous

A service does not care how a message was created, or what will happen in the client after the service performs its actions.

Therefore, version and deploy the service independently from the client.

Therefore, design service contracts assuming that once published, they cannot change.

Services Share Schema And Contract, Not Class

Only message pass between services, not code. The messages are not random; they have been agreed upon.

Service Compatibility Is Based Upon Policy

A service must express what it does and how a client should communicate with it in a standard representation.
Principles Of SOA Design

Standardized Service Contract

Services adhere to an explicit service description.

Loose Coupling

Services minimize dependence on each other.

Service Abstraction

Services hide the logic they encapsulate.

Service Reusability

Divide business logic into several services with the intent of maximizing reuse.

Service Autonomy

Services have control over the logic they encapsulate.

Service Statelessness

Services should be stateless.

The client should not be required to know that operation A, B, and C must be called in a specific order, or that operation D must be followed by E.

Such specific ordering should be contained in a single operation.

Service Discoverability

Services can be discovered, usually in a service registry. Ie, a client can invoke a service regardless of its actual location in the network.

Service Composability

Services break big problems into little problems.

Service Interoperability

Services use standards that allow diverse clients to use the service.
Enterprise Service Bus

ESB stands for Enterprise Service Bus.

A service bus implements a communication system between mutually interacting software.

Instead of N services each communicating with (N-1) services, all services communicate with the service bus only, resulting in only N lines of communication. The service bus passes messages through to the target service.