Unit IV - SOA Material
Unit IV - SOA Material
Principles of Service-Orientation
Service-orientation and the enterprise
The collective logic that defines and drives an enterprise is an ever-evolving entity
constantly changing in response to external and internal influences. From an IT
perspective, this enterprise logic can be divided into two important halves: business logic
and application logic (Figure 8.1).
Each exists in a world of its own, and each represents a necessary part of contemporary
organization structure. Business logic is a documented implementation of the business
requirements that originate from an enterprise's business areas. Business logic is
generally structured into processes that express these requirements, along with any
associated constraints, dependencies, and outside influences.
Figure 8.2. The service interface layer positioned between enterprise layers that promote
application and business logic.
Services modularize the enterprise, forming standalone units of logic that exist within a
common connectivity layer. Services can be layered so that parent services can
encapsulate child services. This allows for the service layer to consist of multiple layers
of abstraction (as explained later in Chapter 9).
Let's first recap some Web services fundamentals within a logical modeling context. As
shown in Figure 8.4, each Web service contains one or more operations. Note that this
diagram introduces a new symbol to represent operations separately from the service.
Figure 8.4. A Web service sporting two operations.
Each operation governs the processing of a specific function the Web service is capable
of performing. The processing consists of sending and receiving SOAP messages, as
shown in Figure 8.5.
By composing these parts, Web services form an activity through which they can
collectively automate a task (Figure 8.6).
o SOAP messages
o Web service operations
o Web services
o activities
The latter three items represent units of logic that perform work and communicate using
SOAP messages. To better illustrate this in a service-oriented perspective, let's replace
these terms with new ones, as follows:
o messages
o operations
o services
o processes (and process instances)
You'll notice that these are quite similar to the terms we used before. The one exception
is the use of "process" instead of "activity." In later chapters we actually use the word
"activity" in different contexts when modeling service-oriented business processes.
For now, the one discrepancy to be aware of is that while a Web service activity is
typically used to represent the temporary interaction of a group of Web services, a
process is a static definition of interaction logic. An activity is best compared to an
instance of a process wherein a group of services follow a particular path through the
process logic to complete a task.
Regardless, for the purposes of our discussion of service-orientation, we'll continue with
our look at how automation logic is comprised of the four identified parts. We can further
qualify these parts by relating each to different sized units of logic, as follows:
Figure 8.7 provides us with a primitive view of how operations and services represent
units of logic that can be assembled to comprise a unit of automation logic.
Figure 8.7. A primitive view of how SOA modularizes automation logic into units.
Next, in Figure 8.8, we establish that messages are a suitable means by which all units
of processing logic (services) communicate. This illustrates that regardless of the scope
of logic a service represents, no actual processing of that logic can be performed without
issuing units of communication (in this case, messages).
Figure 8.8. A primitive view of how units of communication enable interaction between
units of logic.
The purpose of these views is simply to express that processes, services, and
operations, on the most fundamental level, provide a flexible means of partitioning and
modularizing logic. Regardless of the technology platform used, this remains the most
basic concept that underlies service-orientation. In being able to derive this view from
the Web services framework, we also have demonstrated the suitability of the Web
services platform as a means of implementation for SOA.
We'll continue to work with our components of automation logic, but we now broaden our
discussion to how the characteristics and behaviors of these components are formed
within service-oriented architecture.
o A message represents the data required to complete some or all parts of a unit of
work.
o An operation represents the logic required to process messages in order to
complete a unit of work (Figure 8.9).
Having established the core characteristics of our SOA components, let's now look at
how these components are required to relate to each other:
Figure 8.12. How the components of a service-oriented architecture define each other.
This theory has been implemented in different ways with different development
platforms. Object-oriented programming and component-based programming
approaches, for example, achieve a separation of concerns through the use of objects,
classes, and components.
Of these eight, autonomy, loose coupling, abstraction, and the need for a formal contract
can be considered the core principles that form the baseline foundation for SOA. As
explained in the How service-orientation principles inter-relate section later in this
chapter, these four principles directly support the realization of other principles (as well
as each other).
There are other qualities commonly associated with services and service-orientation.
Examples include self-descriptive and coarse-grained interface design characteristics.
We classify these more as service design guidelines, and they are therefore discussed
as part of the design guidelines provided in Chapter 15.
Note
You may have noticed that the reusability and autonomy principles also were mentioned
as part of the contemporary SOA characteristics described in Chapter 3. This overlap is
intentional, as we simply are identifying qualities commonly associated with SOA as a
whole as well as services designed for use in SOA. We further clarify the relationship
between contemporary SOA characteristics and service-orientation principles in Chapter
9.
The processing-specific logic embedded in a message alleviates the need for a service
to contain this logic. More importantly, it imposes a requirement that service operations
become less activity-specificin other words, more generic. The more generic a service's
operations are, the more reusable the service.
Service contracts therefore define almost all of the primary parts of an SOA (Figure
8.15). Good service contracts also may provide semantic information that explains how a
service may go about accomplishing a particular task. Either way, this information
establishes the agreement made by a service provider and its service requestors.
Figure 8.15. Service contracts formally define the service, operation, and message
components of a service-oriented architecture.
Because this contract is shared among services, its design is extremely important.
Service requestors that agree to this contract can become dependent on its definition.
Therefore, contracts need to be carefully maintained and versioned after their initial
release.
No one can predict how an IT environment will evolve. How automation solutions grow,
integrate, or are replaced over time can never be accurately planned out because the
requirements that drive these changes are almost always external to the IT environment.
Being able to ultimately respond to unforeseen changes in an efficient manner is a key
goal of applying service-orientation. Realizing this form of agility is directly supported by
establishing a loosely coupled relationship between services (Figure 8.16).
Figure 8.16. Services limit dependencies to the service contract, allowing underlying
provider and requestor logic to remain loosely coupled.
Loose coupling is a condition wherein a service acquires knowledge of another service
while still remaining independent of that service. Loose coupling is achieved through the
use of service contracts that allow services to interact within predefined parameters.
There is no limit to the amount of logic a service can represent. A service may be
designed to perform a simple task, or it may be positioned as a gateway to an entire
automation solution. There is also no restriction as to the source of application logic a
service can draw upon. For example, a single service can, technically, expose
application logic from two different systems (Figure 8.17).
Figure 8.17. Service operations abstract the underlying details of the functionality they
expose.
Operation granularity is therefore a primary design consideration that is directly related
to the range and nature of functionality being exposed by the service. Again, it is the
individual operations that collectively abstract the underlying logic. Services simply act
as containers for these operations.
A service can represent any range of logic from any types of sources, including other
services. The main reason to implement this principle is to ensure that services are
designed so that they can participate as effective members of other service
compositions if ever required. This requirement is irrespective of whether the service
itself composes others to accomplish its work (Figure 8.19).
The requirement for any service to be composable also places an emphasis on the
design of service operations. Composability is simply another form of reuse, and
therefore operations need to be designed in a standardized manner and with an
appropriate level of granularity to maximize composition opportunities.
In Plain English
Given that the services provided by the Business License Office are distinct and reusable, it can be ask
other government offices to participate in the completion of other services. For example, the Business R
Office manages all administrative paperwork for businesses that need to be moved when their location i
for demolition.
As part of its many tasks, this office takes care of revising the business license information for the affect
does so by enlisting the Business License Office and requesting that they issue a new business license
organization.
By reusing the services offered by the Business License Office, the Business Relocation Office has effe
composed services, much like a controller service reuses and composes other service providers.
Autonomy requires that the range of logic exposed by a service exist within an explicit
boundary. This allows the service to execute self-governance of all its processing. It also
eliminates dependencies on other services, which frees a service from ties that could
inhibit its deployment and evolution (Figure 8.22). Service autonomy is a primary
consideration when deciding how application logic should be divided up into services
and which operations should be grouped together within a service context.
Deferring the location of business rules is one way to strengthen autonomy and keep
services more generic. Processes generally assume this role by owning the business
rules that determine how the process is structured and, subsequently, how services are
composed to automate the process logic. This is another aspect of orchestration
explored in the Orchestration service layer section in Chapter 9.
Note that autonomy does not necessarily grant a service exclusive ownership of the
logic it encapsulates. It only guarantees that at the time of execution, the service has
control over whatever logic it represents. We therefore can make a distinction between
two types of autonomy.
o Service-level autonomy Service boundaries are distinct from each other, but the
service may share underlying resources. For example, a wrapper service that
encapsulates a legacy environment that also is used independently from the
service has service-level autonomy. It governs the legacy system but also shares
resources with other legacy clients.
o Pure autonomy The underlying logic is under complete control and ownership of
the service. This is typically the case when the underlying logic is built from the
ground up in support of the service.
Services should minimize the amount of state information they manage and the duration
for which they hold it. State information is data-specific to a current activity. While a
service is processing a message, for example, it is temporarily stateful (Figure 8.24). If a
service is responsible for retaining state for longer periods of time, its ability to remain
available to other requestors will be impeded.
Figure 8.24. Stateless and stateful stages a service passes through while processing a
message.
Statelessness is a preferred condition for services and one that promotes reusability and
scalability. For a service to retain as little state as possible, its individual operations need
to be designed with stateless processing considerations.
Discovery helps avoid the accidental creation of redundant services or services that
implement redundant logic. Because each operation provides a potentially reusable
piece of processing logic, metadata attached to a service needs to sufficiently describe
not only the service's overall purpose, but also the functionality offered by its operations.
Note that this service-orientation principle is related to but distinct from the contemporary
SOA characteristic of discoverability. On an SOA level, discoverability refers to the
architecture's ability to provide a discovery mechanism, such as a service registry or
directory. This effectively becomes part of the IT infrastructure and can support
numerous implementations of SOA. On a service level, the principle of discoverability
refers to the design of an individual service so that it can be as discoverable as possible.