Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Summary - Haleh (first draft)

  • Its ready to use

Introduction - Haleh

There are has been many articles on SOA and Service Component Architecture. We are not about to repeat the same story. You can refer to any of the references below 1 to learn more about Service Component Architecture. Instead, let's focus on a real, available, open source implementation for Service Component Architecture that provides a simple way to implement SOA solutions. This open source solution is called Apache Tuscany. It has been around for a while and is getting real use by many adopters. Apache Tuscany release 1.0 which was announced in September 2007 supports Service Component Architecture specification 1.0, but the interesting aspect of Tuscany is that in addition to the spec implementation, it is also an implementation nursery for new ideas that are not part of the specification yet. Some of these ideas will find their way to the specifications and some will be regarded as extensions. For example, support for Ruby, JavaScript, Xquery, web 2.0, distribution and management. This article will walk you through what is available in Tuscany, and therefore SCA benefits, with real use case scenarios.

Using samples from Tuscany.

Using Tuscany SCA

A Common Approach To Application Construction and Deployment

...

- Haleh

Let's consider business services and leave IT things such as hardware, software and networks on side for the moment. First, we need to identify the business functions and model them as service components. Secondly the relationship between business functions is described. For example, Order Processing needs to deal with Inventory and Shipment. These dependencies are captured as references and services.

Business Functions

Services Provided

Services Consumed

Order Processing

Process Orders

Check Inventory, Collect Payment, Arrange Shipments

Inventory

Check Inventory

Warehouse

Payment

Collect payment

Credit Card Authorization, PayPal

Shipment

Ship the order

Shippers such as UPS, USPS or Fedex

Not surprisingly these concepts map directly to terms used in Tuscany SCA.

Business Functions

Components

What business functions are provided?

Services

What business functions are consumed?

References

What can be customized in the business logic?

Properties

How is the business logic implemented?

Implementation

How are the depending services fulfilled?

Wire

How are the components communicated?

Binding

How are the quality of services enforced?

Intent/Policy

  • Implement the business functions using the preferred languages
  • Integrate with existing business functions

One of the less obvious benefits of a service orient approach and of the Service Component Architecture in particular is the potential to shrink the gap between the business and the IT organization which supports it, or even between different parts of the same IT organization.

Using a consistent model of applications and of the components from which they are constructed provides a common terminology and supports a common understanding of applications and they way that they work together. This common model provides the hook for tooling, governance, monitoring and management in the service oriented world.

There is no magic bullet but the use of common terminology and semantics encourages good service design. Using Tuscany SCA to build and assemble components suggests a contract led and technology and protocol independent approach. This in itself tends to lead to cleaner more business aligned components that can be improved, repurposed and reused with less effort than if the components had been written with specific technologies in mind.

This separation of business logic from the details of how a running application is assembled and deployed leads to a degree of software portability. More importantly though it leads to portability of ideas and a shared understanding of the capabilities and construction of the software.

Tuscany SCA achieves these benefits with a fairly light touch. The SCA specifications define an XML description of assembled services which separates service implementation from the technologies used to connect them together into a working application. For example, here is a Java class which implements an account service to provide a getAccountTotal() operation in accordance with the AccountService interface.

Code Block

@Service(AccountService.class)
public class AccountServiceImpl implements AccountService {

    @Reference
    protected AccountDataService accountDataService;

    public double getAccountTotal(String customerID) {

One of the less obvious benefits of a service orient approach and of the Service Component Architecture in particular is the potential to shrink the gap between the business and the IT organization which supports it, or even between different parts of the same IT organization.

Using a consistent model of applications and of the components from which they are constructed provides a common terminology and supports a common understanding of applications and they way that they work together. This common model provides the hook for tooling, governance, monitoring and management in the service oriented world.

There is no magic bullet but the use of common terminology and semantics encourages good service design. Using Tuscany SCA to build and assemble components suggests a contract led and technology and protocol independent approach. This in itself tends to lead to cleaner more business aligned components that can be improved, repurposed and reused with less effort than if the components had been written with specific technologies in mind.

This separation of business logic from the details of how a running application is assembled and deployed leads to a degree of software portability. More importantly though it leads to portability of ideas and a shared understanding of the capabilities and construction of the software.

Tuscany SCA achieves these benefits with a fairly light touch. The SCA specifications define an XML description of assembled services which separates service implementation from the technologies used to connect them together into a working application. For example, here is a Java class which implements an account service to provide a getAccountTotal() operation in accordance with the AccountService interface.

Code Block

@Service(AccountService.class)
public class AccountServiceImpl implements AccountService {

    @Reference
    protected AccountDataService accountDataService;

    public double getAccountTotal(String customerID) {

        CheckingAccount checking = accountDataService.getCheckingAccount(customerID);
        SavingsAccount savings = accountDataService.getSavingsAccount(customerID);

        // Calculate the total balance of all accounts and return it
        double balance = checking.getBalance() + savings.getBalance();

        return balance;
    }
}

Here SCA is asked to make this AccountService available over the JSONRPC protocol.

Code Block

<component name="AccountServiceComponent">
        <implementation.java class="bigbank.account.AccountServiceImpl"/>
        <serviceCheckingAccount checking name="AccountService">= accountDataService.getCheckingAccount(customerID);
        SavingsAccount savings = accountDataService.getSavingsAccount(customerID);

       <tuscany:binding.jsonrpc uri="/AccountJSONService"/>
 Calculate the total balance of all accounts and return it
  <binding.ws />
     double balance  </service>
</component>

The precise relationship between the abstract components and runtime infrastructure is further refined using policy statements to apply organizationally agreed constrains on the behaviour of the application in its deployed environment. For example, this could range from dictating which communications should be encrypted to describing what level of monitoring and logging is required.

Tuscany SCA does not define new technologies for component implementations and message exchange. It neither requires you to learn a new programming language or communications protocol. You are free to leverage you existing investment in applications and technology with the one proviso that a suitable binding exists in Tuscany SCA. This is not much of a hurdle though as Tuscany SCA has a straightforward extensibility model so new or proprietary technologies can easily be included.

The following sections describe Tuscany SCA in the context of a number of familiar use cases.

Enterprise Integration

Let's consider business services and leave IT things such as hardware, software and networks on side for the moment. First, we need to identify the business functions and model them as service components. Secondly the relationship between business functions is described. For example, Order Processing needs to deal with Inventory and Shipment. These dependencies are captured as references and services.

Business Functions

Services Provided

Services Consumed

Order Processing

Process Orders

Check Inventory, Collect Payment, Arrange Shipments

Inventory

Check Inventory

Warehouse

Payment

Collect payment

Credit Card Authorization, PayPal

Shipment

Ship the order

Shippers such as UPS, USPS or Fedex

Not surprisingly these concepts map directly to terms used in Tuscany SCA.

Business Functions

Components

What business functions are provided?

Services

What business functions are consumed?

References

What can be customized in the business logic?

Properties

How is the business logic implemented?

Implementation

How are the depending services fulfilled?

Wire

How are the components communicated?

Binding

How are the quality of services enforced?

Intent/Policy

...

= checking.getBalance() + savings.getBalance();

        return balance;
    }
}

Here SCA is asked to make this AccountService available over the JSONRPC protocol.

Code Block

<component name="AccountServiceComponent">
        <implementation.java class="bigbank.account.AccountServiceImpl"/>
        <service name="AccountService">
            <tuscany:binding.jsonrpc uri="/AccountJSONService"/>
            <binding.ws />
        </service>
</component>

The precise relationship between the abstract components and runtime infrastructure is further refined using policy statements to apply organizationally agreed constrains on the behaviour of the application in its deployed environment. For example, this could range from dictating which communications should be encrypted to describing what level of monitoring and logging is required.

Tuscany SCA does not define new technologies for component implementations and message exchange. It neither requires you to learn a new programming language or communications protocol. You are free to leverage you existing investment in applications and technology with the one proviso that a suitable binding exists in Tuscany SCA. This is not much of a hurdle though as Tuscany SCA has a straightforward extensibility model so new or proprietary technologies can easily be included.

The following sections describe Tuscany SCA in the context of a number of familiar use cases.

Enterprise Applications - Raymond

How SCA works with existing technologies. One solution that works with everything.

...

Once we have all the business logic implemented, we can then decorate the references and services with proper bindings so that they can collabrate over the networks.

...

TODO - Policy driven approach

binding.ws

Enabling Web 2.0 - Simon

A web2.0 style application's ability to present a dynamic and responsive interface relies on an organization's ability to provide services for the application to interact with. As you might expect Tuscany SCA is ideally placed to provide those services using popular technologies such as JSONRPC, XML, RSS and Atom. From the Tuscany Java SCA store sample (samples/store) you can see a catalog service providing a service over JSONRPC

...

Code Block
function add(n1, n2) {
   return n1 + n2;
}

Data integration - Raymond

In an SOA environment, business service collaborations are achieved by data exchanges between service components. Business data come from different sources and they are represented in different ways. Tuscany provides a few features in the data area to facilitate the data integrations.

...

Code Block
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
    targetNamespace="http://bigbank" name="BigBank">

    <component name="CustomerAsset">
        <implementation.java class="bigbank.CustomerAssetImpl" />
        <reference name="accountData" target="AccountData" />
        <reference name="stockValue" target="StockValue" />

        <reference name="exchangeRate">
            <tuscany:binding.rss
                uri="http://ansuz.sooke.bc.ca/rippy/exchange/?M=R&amp;B=USD&amp;F=CAD,CNY,EUR&amp;T=F&amp;S=O&amp;I=S" />
        </reference>
    </component>

    <component name="AccountData">
        <implementation.java class="bigbank.AccountDataImpl" />
    </component>

    <component name="StockValue">
        <tuscany:implementation.xquery location="stock.xq" />
        <!-- 
        <property name="currency">USD</property>
         -->
    </component>

    <reference name="StockQuoteReference" promote="CustomerAsset/stockQuote">
        <binding.ws wsdlElement="http://swanandmokashi.com#wsdl.port(StockQuotes/StockQuotesSoap)" />
    </reference>

</composite>

...

Into The Enterprise - Simon

Distribution
Policy
Alternative impl Scripting BPEL

The service oriented approach to building applications promotes the benefits of deploying running solutions as a collection of loosely coupled services. Tuscany Java SCA provides a runtime that will host these loosely couple services in a single JVM or across multiple JVMs.

...

The benefit of this approach is that the infrastruture can be adjusted and the components redeployed without having to change any .composite file information.

Getting Started With Your Own Project - TBD

The easiest way to get started with Tuscany SCA is to download the latest release and try some of the samples. You can get the latest release from here (http://incubator.apache.org/tuscany/sca-java-releases.html).

...

V1.0 ready for prime time?
It is extensible so you can add to it (and contribute)

References

Old Words

Introduction

The Service Component Architecture would never claim to solve every one of your distributed computing problems, or even provide and answer to all of the questions you are likely to have about Service Oriented Architecutures. It does how ever provide a consistent component programming and assembly model that will pay dividends in lots of situations.

...