Service-Oriented Architecture (SOA)


Creative Commons License
This -Service-Oriented Architecture- (SOA) tutorial is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License
Preamble

This tutorial is an introduction to Service-Oriented Architecture (SOA) and Microservices. It is mostly illustrated by means of the Java EE platform, Business Process Model and Notation (BPMN), Web Services Business Process Execution Language (WS-BPEL), and Java Business Process Management (jBPM) with a focus on business-oriented services.

Middleware

Middleware standards

Distributed Computing Environment (DCE)

Common Object Request Broker Architecture (CORBA)

Open Services Gateway initiative (OSGi)

Internet

Client/server computing (example)

Three-tier architecture

Three-tier Java application (sample)

Technical services

Technical services are natively offered by middleware. Applications call for such predefined/pre-implemented services in order to avoid the development of their own policy for security, transaction management, etc.

Security

For instance, Enterprise Beans can be endowed by security features to limit their access by third-party components/services. Security features are access roles and associated credentials.

Messaging

For instance, Java Message Service (JMS) in Java EE or CORBA Event Service in CORBA allow asynchronous communication between components/services.

Timer services

For instance, timer services in the EJB technology (below) can be requested in a uniform way by components/services. Such services in particular avoid the use of internal clocks. Typically, the Timer and TimerTask classes from Java SE have not to be used in Java EE because of distribution. This corresponds to the need for temporal data that are independent of each JVM (Java Virtual Machine) involved in distributed computing.

Transaction management

Java Transaction Service (JTS) is the introduction in Java of the Object Transaction Service (OTS) from CORBA. Java Transaction API (JTA) is a set of Java EE classes and interfaces to manage transactions among distributed components/services.

Application monitoring and control

JMX (Java Management eXtensions) is a Java SE technology to monitor Java applications: tracing, stopping, restarting, etc. The Java logging API is another service for application tracing.

Naming

Java Naming and Directory Interface (JNDI) is a Java SE technology to manage names of resources (e.g., message queues, data sources, URLs, computing units like components/services...) in distributed systems. This covers resource location search and resource binding to handle these resources in programs.

Persistence

Service-Oriented Architecture (SOA)

Enterprise Service Bus (ESB)

An ESB eases the discovering and access to services in a business perspective (administrations, companies, divisions of companies, holdings...). It includes, for instance, service interoperability, both from a syntactical and semantic viewpoint through, in the second case, service mediation facilities. For example, the Apigee ESB is a platform for advanced SOA.

Cloud computing

Cloud computing is the most innovative SOA application principle based on the now famous IaaS (Infrastructure as a Service), PaaS (Platform as a Service) and, SaaS (Software as a Service) trio.

Big data

Big data refers to immense data sets generally produced by Internet devices, users... These data sets are characterized by a high scattering, even a deep dilution. Big data is associated with a set of devoted technologies like Map/Reduce (Apache Hadoop), NoSQL, etc.

The notions of “Component” and Component-Based Development (CBD)

Influences

Definitions

Szyperski, C., Gruntz, D., and Murer, S.: “Component Software – Beyond Object-Oriented Programming”, Second Edition, Addison-Wesley (2002)
Software Engineering Institute, Carnegie Mellon University: “Volume I: Market Assessment of Component-Based Software Engineering” (May 2000)

Component-based software engineering

Component-based development cycle

Component-based development cycle

Component sorts

Component examples

Card reader in UML:

Currency in IDL:

…
module FbcCurrency {
    value Currency
    value Money;
    …
    interface StateIdManager;
    interface CurrencyBook;
    …
    exception FbcException {…};
    …
};

Run indicator (as part of a programmable thermostat) in JavaBeans™:

public interface Run_indicator_client extends java.beans.PropertyChangeListener {…}

public class Programmable_thermostat extends … implements Run_indicator_client, … {…}

public class Run_indicator implements java.io.Serializable {
    …
    public Run_indicator(Run_indicator_client programmable_thermostat) throws Statechart_exception {
        …
        propertySupport = new java.beans.PropertyChangeSupport(this);
        propertySupport.addPropertyChangeListener(programmable_thermostat);
    }
    public void off() throws Statechart_exception {
        _Run_indicator.fires(_Something_on,_Everything_off);
        _Run_indicator.run_to_completion();
        _setStatus(_Run_indicator.current_state());
    }
    private void _setStatus(String newValue) {
        String oldValue = status;
        status = newValue;
        propertySupport.firePropertyChange("Run indicator status",oldValue,newValue);
    }
    …
}
Technical component models

JavaBeans™ Component Model (tutorial)

Enterprise JavaBeans™ (EJB)

CORBA Component Model (CCM)

Fractal

Component Object Model (COM)

“Service” versus “component”

Definitions

“Service”, discriminating characterization

SOA characterization
Business services

A business service gathers in one self-contained piece a set of high-cohesive functionalities. This set belongs to a domain: healthcare, finance, air traffic control…

Readers are invited to visit the ProgrammableWeb site to find the ever-increasing richer set of worldwide business services! Service computing-based business is “business as usual”, e.g., outsourcing software development, deployment and commissioning.

Service composition

As a kind of component, a service is subject to composition operations. For example, a Payment business process may call currency conversion functionalities before calling money transfer functionalities. One may abstractly express this by means of UML Components Diagrams.

One may also express this in relation with a given technology, say, Web Services.



Precise (technology-free) composition may require behavioral details like sequencing of the Payment business process.

If Web Services is chosen as the target implementation technology then a possible approach is the use of WS-BPEL, which allows both the expression and execution of graphical business processes. In WS-BPEL, service invocations, assignments, data reception and data reply are (graphical) language constructs to consistently and completely design business processes whose atomic activities are extant Web services. WS-BPEL capitalizes on the capabilities of the Web Services technology, which automatically favors implementation. In this scope, WS-BPEL models may be associated with effective pre-deployed Web services. WS-BPEL models may consequently be deployed on (and then executed by) a WS-BPEL engine like, for example, Apache Orchestration Director Engine (Apache ODE).

Recent evolutions of BPMN platforms like Java Business Process Management (jBPM) allow the direct expression and execution of graphical business processes through BPMN only. Typically, service activities may be straightforwardly assigned to effective Web services with credentials and other internal connection properties as shown in the following example.

RESTful service

A (business) RESTful service is a simple service that is not bounded to a specific technology. In most cases, it is accessible from the Web by means of a particular API. As an illustration, a professional currency conversion service (paying service with free simplified version) is provided by the Open Exchange Rates Web site. This case study may be downloaded as a Java SE Apache NetBeans project here

Web service

A Web service obeys to the Web Services technology that in essence goes beyond the Java technology. Typically, a Web service may be designed in .NET and consumed in Java. As an illustration, we here study a professional currency conversion service (paying service) provided by the Currency System Web site. From the fx.currencysystem.com/webservices/CurrencyServer5.asmx address, one finds its documentation. It is a SOAP Web service over HTTP or HTTPS. As discussed below, a SOAP Web service requires a WSDL (Web Services Description Language) specification. This SOAP currency conversion service offers a lot of functionalities, including legal information that is often of great importance in finance. In Java, the convert function may be simply (with appropriate included libraries) called as follows:

@javax.xml.ws.WebServiceRef(wsdlLocation = "META-INF/wsdl/fx.currencysystem.com/webservices/CurrencyServer5.asmx.wsdl") // Location of the WSDL specification
com.currencysystem.webservices.currencyserver.CurrencyServer service;
…
com.currencysystem.webservices.currencyserver.CurrencyServerSoap port = service.getCurrencyServerSoap12();
Object o = port.convert(licenseKey, fromCurrency, toCurrency, amount, rounding, format, returnRate, time, type);

The signature of the convert function is in essence the degree of sophistication (and thus functional quality) of the requested service. The licenseKey parameter reveals the paying nature of the call. The convert function is documented in the WSDL specification as follows: fx.currencysystem.com/webservices/CurrencyServer5.asmx?WSDL. Here is an extract of the WSDL code:

<wsdl:documentation> Currency Server - An exchange rate information and currency conversion Web service.
</wsdl:documentation>
…
<s:element name="Convert">
    <s:complexType>
        <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="licenseKey" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="fromCurrency" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="toCurrency" type="s:string"/>
            <s:element minOccurs="1" maxOccurs="1" name="amount" type="s:double"/>
            <s:element minOccurs="1" maxOccurs="1" name="rounding" type="s:boolean"/>
            <s:element minOccurs="0" maxOccurs="1" name="format" type="s:string"/>
            <s:element minOccurs="1" maxOccurs="1" name="returnRate" type="tns:curncsrvReturnRate"/>
            <s:element minOccurs="0" maxOccurs="1" name="time" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="type" type="s:string"/>
        </s:sequence>
    </s:complexType>
</s:element>

In this specification, one may for example observe that the rounding is just a Boolean option. The client application must then take in charge of precision/rounding management by setting the rounding parameter to false and later applying a local policy (business rule). Note: Apache CXF offers tools to automatically generate client programs (consumers) in Java, JavaScript or other languages from WSDL code.

Free service

A Web service differs from another in technology (SOAP, RESTful… see below) and in price! As an illustration, we here study a free currency conversion service provided by the RESTFul Web Services Web site. At the www.restfulwebservices.net/service.aspx?ID=2 address, one is able to find the Web service's documentation. In Java, bringing back the desired exchange rate may be simply (with appropriate included libraries) realized as follows:

@javax.xml.ws.WebServiceRef(wsdlLocation = "META-INF/wsdl/www.restfulwebservices.net/rest/CurrencyService.svc.wsdl")
net.restfulwebservices.servicecontracts.rest._2008._01.CurrencyService service;
…
net.restfulwebservices.servicecontracts.rest._2008._01.ICurrencyService port = service.getWebHttpBindingICurrencyService();
Object o = port.getConversionRate(parameters); // Conversion rate acquisition (free), but direct conversion is not supported!

The parameters object (Java type is net.restfulwebservices.servicecontracts.rest._2008._01.GetConversionRate) sent at request time simply has the setFromCurrency and setToCurrency functions to set the source and target currencies. In return, one may obtain the exchange rate from these two values in parameters.

Web Services technology

RESTful Web Services have taken the leadership because of their wide take-up by leaders like Google, Amazon, Facebook, etc. RESTful Web services single out the idea of “resource” as the key means to retrieve data from Web places supporting exposed Web services. While RESTful Web services may be described with the help of WSDL, WADL (Web Application Description Language) is the preferred means for that.