Service Oriented Architecture
Service Oriented Architecture
Service Oriented Architecture
In order to reduce the costs of enterprise system development, startups and small businesses
also move their systems to the cloud. This actually allows them to have a shorter time and faster
speed on rolling out new services because they do not need to worry problems, such as
hardware maintenance, network resources scaling, which can now be easily configured on the
cloud. Also, since most of the enterprise data and resources are on the cloud, resource sharing is
much easier and more efficient as compared to the past when the data is stored internally.
The biggest problem in programming is often it is very difficult to keep the business logic
separated from the so-called “computer logic” as mentioned above. What makes matter worse is
that these non-IT folks can change the business logic any time, without understanding how a
small change could result in possibly disproportionate amount of work required by the IT folks
to implement the change. In the next section, we will see that in Service Oriented Architecture,
implementing business changes logic is no big deal.
Separation of Concerns
“Separation of concerns and is a software engineering best practice that should be applied in the
design of all technology systems intended for business users. Unfortunately, this best practice
has been observed more in theory than in practice. If you discuss this issue with software
engineers, you may hear many excuses. The separation of concerns is often ignored simply
because it takes effort to abide by it, and the costs of ignoring it are all in the future — in other
words, too often, “quick and dirty” wins out over “slow and sure.” Creating a reusable
architecture takes discipline. And discipline inevitably takes more time than you’d ever expect
to establish itself. Management may need to be educated. The upfront costs of establishing and
requiring discipline pay manifold dividends over time.”
-Service Oriented Architecture for Dummies
7
Software Development Tools and Technologies
2.1.2 Interoperability
As we can see in the beginning of the section, just as interoperability is a requirement of an
enterprise system, it is also a challenge at the same time. The ideal scenario is that there is
homogeneity in the systems used across the organizations. Again that is simply hard or not even
possible. Even if it is, in the context of the business world, the company might acquire another
company that uses a totally different IT system altogether. The result is that additional work has
to be done to allow interoperability. This can yet introduce another problem associated with the
reluctance to migrate or upgrade existing system. Having invested effort and resources to allow
interoperability, migrating to a new system might pose challenges if it is not compatible with
existing system.
2.1.4 Redundancies
A problem that is common to many large companies is that there are many similar yet slightly
different applications that are used throughout the organization. Each department usually
comes out with its own version of software components rather than coordinate with other
departments to see if component reuse is possible. The latter turns out to take too much effort
as such it usually involves chores such as going through rounds of inter-departmental meetings
to determine the common functionalities amongst the different systems and what or what not to
be included in the system.
While companies might have policies or guidelines for such scenarios, often when deadlines are
tight, or due to budget issues, it is often more convenient to build the application the
department needs rather than coordinate across divisions. The problem can surface again when
one company acquires another and realise that they too have similar applications with the
similar functionality.
Another issue with such redundancies is the increased effort and complexity to maintain such
applications. Any change in business policy will probably render these applications obsolete. All
updates will then have to be propagated through these instances of the application. Again in the
context of enterprise systems, where the problem is magnified, this translates to higher cost of
IT costs and inefficiencies, something that is not desirable.
8
Ch10: Service Oriented Architecture
Currency Product
Location
Converter
Access
Real-time
Financial Database/
Data Catalog
Interoperability
The application has to get real-time financial data to perform local currency conversion as well
as interface with a database server to retrieve product information. As the two systems are
probably different, the developer has to take care of interfacing.
Redundancies
The interfacing component required might have already been developed by other divisions of
the company, probably even in other country. However, chances are that it will be unknown to
the current developer and the same work is duplicated. Another hurdle in sharing components
is that different departments across the organization might not be using similar technology in
developing their application and hence increased the difficulty in component reuse.
Isolating Business Logic
In the example of accessing the database, the developer needs to know the database schema,
what table to query, how to construct the SQL query etc., the usual chore that distracts the
developer from the real work of implementing the application and business logic. Consequently,
when the database schema changed, the application breaks and the data access component need
to be updated accordingly. The updated component will have to go through unit testing,
integration testing etc. before it is deployed. Again these chores are duplicated across the
organization. In general, the typical architecture of a non-SOA system will similar to Figure 2.
9
Software Development Tools and Technologies
Application Code
Business Objects
Application
Data /
Persistence
Application Code
Business Objects
Application
Services
Data /
Persistence
Application
Currency Product
Location
Converter Access
Having introduced the notion of services, let us look at different types of services.
10
Ch10: Service Oriented Architecture
Business services
Entity services
Functional services
Utility services
Business services
Business service can be defined as the logical encapsulation of business functions. It has to be
relevant to the business of the organization is running. An easy way to determine whether a
service is a business service is to ask whether the service can be created without the
consultation of business managers. If not, the service isn’t probably a business service.
Another desirable feature of a business service is that it should have as little dependencies as
possible so that it can be reused easily throughout the organization. This reusability means that
there is consistency. In addition, any change in business policy can be propagated throughout
the organization much more easily.
While the concept of reusability might already be familiar in the world of software engineering,
in SOA the level of reuse is different. The concept of reusability in SOA refers to reusable high-
level business services rather than reusable low-level components.
In view of the above discussion, it is indeed by no means easy to identify appropriate business
services in a SOA. It involves both the IT and business departments to do that. Nevertheless, it is
an important step as defining business services is important to building a strategic SOA.
Business services are not the only services in SOA. A typical service model might include Entity
Services, Task/Functional Services and Utility/Process Services.
Entity services
An entity service usually represents business entities (e.g. Employee, Customer, Product,
Invoice etc.). Such entity service usually expose CRUD (create, read, update, delete) operations.
Functional services
Functional services do not represent business-related tasks or functions. Rather it usually can
be represented in a sequence diagram. In other words, it is usually a technology-oriented
service and not a business oriented one. Task services can be thought of as controller of
composition of services and hence its reusability is usually lower.
Utility services
Utility services offers common and reusable services that are usually not business centric. They
might include event logging, notifications exception handling etc.
11
Software Development Tools and Technologies
<s:element name="ConversionRate">...
<s:element name="FromCurrency" type="tns:Currency" />
<s:element name="ToCurrency" type="tns:Currency" />
</s:element>
The XML above shows a possible excerpt of a WSDL document which defines a ConversionRate
method that requires two parameters, namely FromCurrency and ToCurrency of type Currency.
2.3.4 SOAP
The next step after knowing the method signature is to invoke it. In web services, it is
accomplished through SOAP messages. SOAP traditionally stands for Simple Object Access
Protocol. However, from SOAP 1.2 onwards, the acronym is dropped as the name does not really
represent what SOAP is. A SOAP message again is written in XML and sent to the web service
over HTTP for web service consumption. The web service consumer or client will be able to
construct the correct SOAP messages solely based on the WSDL document. Similarly, the
response will also be in SOAP format. An excerpt of a SOAP message is given below.
12
Ch10: Service Oriented Architecture
<soap:Body>
<ConversionRate xmlns="http://www.webserviceX.NET/">
<FromCurrency>USD</FromCurrency>
<ToCurrency>SGD</ToCurrency>
</ConversionRate>
</soap:Body>
13