OpenCSA Member Section – Service Component Architecture 1OpenCSA Member Section – Service Component Architecture 1
SCA: Flexible and Agile SCA: Flexible and Agile Composition of Distributed Composition of Distributed
SOA ApplicationsSOA Applications
www.oasis-open.org
Mike Edwards - IBMHursley Lab, England
SSimplicity, implicity, CConsumability, onsumability, AAgilitygility
OpenCSA Member Section – Service Component Architecture 2OpenCSA Member Section – Service Component Architecture 2
Agenda
Customer scenario SCA overview SCA details Web 2.0 & SCA
OpenCSA Member Section – Service Component Architecture 3OpenCSA Member Section – Service Component Architecture 3
Customer scenario A bank implemented a pilot project using SCA and SDO Growing presence in multiple countries Wide variety of technologies in use:
Unix Mid Range, AS400, Mainframe, WebSphere / WebLogic, Java / .NET, Kitchen Sink
The group that sponsored the project is responsible for Retail Banking Channel – Presentation and Service Tier
Rollout of "Official" SOA strategy Set the standards for future initiatives within the Bank
OpenCSA Member Section – Service Component Architecture 4OpenCSA Member Section – Service Component Architecture 4
Problem: Lack of an enterprise-wide SOA framework Proliferation of standards and frameworks
WS-* Apache SOAP Apache AXIS XFire IBM Web Services Runtime Open source frameworks Custom built frameworks
Never ending cycle of migration and reinventing the wheel Hurting time to market Extra costs to maintain
Need to simplify service development Allow service developers to focus on business logic Make it easy to reuse services
OpenCSA Member Section – Service Component Architecture 5OpenCSA Member Section – Service Component Architecture 5
Key features of the customer’s infrastructure Service Platform – WS-I Basic compliant, Java-based
client invocation and service endpoint framework Expose services using different interfaces, multiple
invocation mechanisms (local, WSDL/schema, JMS...) Service Lifecycle Events – Logging, Caching, Business
Validation, Error Handling... Enable POJO programming model for developing services Requirements, design, development, operational and other
processes to support SOA approach
OpenCSA Member Section – Service Component Architecture 6OpenCSA Member Section – Service Component Architecture 6
Key features of the customer’s infrastructure Enterprise adoption:
Development, Deployment, Operational, Governance Capabilities
Service development training material Collaborative, shared ownership
All process, technical and other documentation placed in a Wiki, open to contributions
Improvements took place using an "open source" model, allowing any resource to contribute to code base, with select group controlling commits
OpenCSA Member Section – Service Component Architecture 7OpenCSA Member Section – Service Component Architecture 7
Service Platform
Rich Client UI Mobile IVR
Component
pro
pert
ies
Component
pro
pert
ies
Component
pro
pert
ies
Component
pro
pert
ies
Web User Interface Components
Different Heterogeneous Backend Systems
ThinClient
Browser / AJAX
OpenCSA Member Section – Service Component Architecture 8OpenCSA Member Section – Service Component Architecture 8
Layers in the infrastructure Access layer:
Spring Framework (AOP, IOC) for applications, IFX (Interactive Financial Exchange) for schemas and
interfaces SCA/SDO to access services & data sources
Middle tier: WebSphere, Spring, JMS Services built with SCA assembly model IFX data packaged with SDO
Back end: The usual suspects (transaction servers, mainframes,
relational databases, packaged apps)
OpenCSA Member Section – Service Component Architecture 9OpenCSA Member Section – Service Component Architecture 9
Infrastructure based on three open standards SCA/SDO:
Becoming widely recognized as a standard
Support for multiple bindings configurable at runtime
Configuration based assembly of components using dependency injection
Components can be implemented using many languages/technologies
Multiple implementations to choose from
Interactive Financial Exchange (IFX)
Standards-based data exchange format for business banking
Spring AOP for lifecycle events
(Logging, Caching, Error Handling, etc.)
Finer grained dependency injection
OpenCSA Member Section – Service Component Architecture 10OpenCSA Member Section – Service Component Architecture 10
Selling SCA SCA, SDO enabled business to build service
platform with low barriers to adoption: POJO components Evolutionary SOA adoption Open communities
Some original applications used POJOs. To moving to an SOA, applications changed to use SCA services
For now, the SCA services are just POJOs. When they need to use other kinds of (SCA) services, they don’t have to make any changes
OpenCSA Member Section – Service Component Architecture 11OpenCSA Member Section – Service Component Architecture 11
The future Future enhancements to infrastructure will take
advantage of wider features of SCA and SDO: WS-Policy/WS-Security Other implementations (COBOL) Asynchronous invocation (JMS) Presentation layer (AJAX, JSONRPC) BPEL orchestration
Using these features will require very few changes (if any) to their applications
OpenCSA Member Section – Service Component Architecture 12OpenCSA Member Section – Service Component Architecture 12
Agenda
Customer scenario SCA overview SCA details Web 2.0 & SCA
OpenCSA Member Section – Service Component Architecture 13OpenCSA Member Section – Service Component Architecture 13
What SCA is executableexecutable model for assembling services
composites provide language to compose and configure service components
handles service dependencies
Simplified component programming modelcomponent programming model for implementing services
BPEL processes, Java POJOs, EJBs, COBOL, PHP scripts, C++ apps, JavaScript & AJAX, XSLT…
Late binding of policypolicy and communicationcommunication methods, with distributed deploymentdistributed deployment model
OpenCSA Member Section – Service Component Architecture 14OpenCSA Member Section – Service Component Architecture 14
Why SCA makes life simpler One way to look at SCA is that it takes details of
access methods and endpoints implementations and configuration policy such as encryption, authentication
…and moves them into middleware layer Application developers write business logic: code
that actually builds value for your organization details of using services are handled by SCA late binding: as details change, applications (and
developers who wrote them) aren’t affected "no plumbing in the code"
OpenCSA Member Section – Service Component Architecture 15OpenCSA Member Section – Service Component Architecture 15
Why SCA makes life simpler SCA gives developers a
single programming model for using servicessingle programming model for using servicesfor all aspects of service lifecycle:
– Construction– Assembly– Deployment
As your SOA gets more complex, developers have to learn more and more interfaces
– In Java alone: EJBs, RMI, JCA, JAX-WS, JMS
Similarly, SDO gives developers a single single programming model for using data sourcesprogramming model for using data sources
OpenCSA Member Section – Service Component Architecture 16OpenCSA Member Section – Service Component Architecture 16
SCA is not… …tied to a specific programming language,
protocol, technology, runtime …a workflow model
Use BPEL for that …Web services
SCA can access local objects, avoiding the overhead of Web services
of course, many SCA applications will use Web services
…an ESB to program an ESB from scratch, SCA fits perfectly but SCA is more than an ESB
OpenCSA Member Section – Service Component Architecture 17OpenCSA Member Section – Service Component Architecture 17
Warehouse Service
WarehouseComposite
WarehouseBroker
Component
WarehouseComponent
Order Processing
Service
OrderProcessingComponent
Shipping Reference
External Warehouse
Reference
PaymentsComponentPayment
Service
AccountsComposite
ExternalBanking
Reference
AccountsLedger
Component
SCA assembly
BPEL
Java EE
C++
SOAP/HTTP
JMS
RMI/IIOP
Mixed:- technologies- app locations
Multi-levelcomposition
OpenCSA Member Section – Service Component Architecture 18OpenCSA Member Section – Service Component Architecture 18
Agenda
Customer scenario SCA overview SCA details Web 2.0 & SCA
OpenCSA Member Section – Service Component Architecture 19OpenCSA Member Section – Service Component Architecture 19
ServiceAccountService
ReferenceStockQuoteService
AccountDataServiceComponent
bigbank.accountcomposite
AccountServiceComponent
ServiceAccountService
AccountDataServiceComponent
Simple Example
OpenCSA Member Section – Service Component Architecture 20OpenCSA Member Section – Service Component Architecture 20
<reference name=“StockQuoteService" promote="AccountServiceComponent/StockQuoteService"> <interface.java interface="services.stockquote.StockQuoteService"/> <binding.ws port="http://example.org/StockQuoteService# wsdl.endpoint(StockQuoteService/StockQuoteServiceSOAP)"/> </reference>
<service name="AccountService" promote="AccountServiceComponent"> <interface.java interface="services.account.AccountService"/> <binding.ws port="http://www.example.org/AccountService# wsdl.endpoint(AccountService/AccountServiceSOAP)"/> </service>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="bigbank.accountcomposite" >
<composite>
<component name="AccountServiceComponent"> <implementation.java class="services.account.AccountServiceImpl"/> <reference name="StockQuoteService"/> <reference name="AccountDataService" target="AccountDataServiceComponent/AccountDataService"/> <property name="currency">EURO</property> </component>
<component name="AccountDataServiceComponent"> <implementation.bpel process=“QName"/> <service name="AccountDataService"> <interface.java interface="services.accountdata.AccountDataService"/> </service> </component>
StockQuotebigbank.accountcomposite
AccountServiceComponent
ServiceAccountService
ReferenceStockQuoteService
AccountDataServiceComponent
ReferenceStockQuoteService
OpenCSA Member Section – Service Component Architecture 21OpenCSA Member Section – Service Component Architecture 21
Java Implementation Example: Service Interface
package org.example.services.account;
@Remotablepublic interface AccountService {
public AccountReport getAccountReport(String customerID);}
Interface is callable remotelyeg. as a Web service
OpenCSA Member Section – Service Component Architecture 22OpenCSA Member Section – Service Component Architecture 22
Java Implementation Example (1)
package org.example.services.account;
import org.osoa.sca.annotations.*;
@Service(interfaces = AccountService.class)public class AccountServiceImpl implements AccountService {
private String currency = "USD"; private AccountDataService accountDataService; private StockQuoteService stockQuoteService;
public AccountServiceImpl( @Property("currency") String currency, @Reference("accountDataService") AccountDataService dataService, @Reference("stockQuoteService") StockQuoteService stockService) { this.currency = currency; this.accountDataService = dataService; this.stockQuoteService = stockService; }
Annotation for the service offered by this class
Constructor with annotations for injected property and references
OpenCSA Member Section – Service Component Architecture 23OpenCSA Member Section – Service Component Architecture 23
Java Implementation Example (2)
public AccountReport getAccountReport(int customerID) throws AccountDataUnavailableException {
AccountReport accountReport = accountDataService.getAccountReport(customerID); List<Stock> stocks = accountReport.getStocks();
List<StockValues> stockValues = stockQuoteService.getValues( stocks, currency );
accountReport.setStockValues( stockValues );
return accountReport;}
} // end class
Get the basic account report using the account data service
Obtain up to date stock values using the stock quote service
Update the account report with the latest stock values
OpenCSA Member Section – Service Component Architecture 24OpenCSA Member Section – Service Component Architecture 24
Confidentiality applied to any use of the service
Associating Policies with SCA Components
Intents and/or policySets can be associated with any SCA component
At deployment time intents map to Policies contained in policySets Examples attaching intents:
<service name="AccountService“ promote=“AccountServiceComponent” requires="sca:confidentiality"> <interface.java interface="services.account.AccountService"/> <binding.ws port="http://www.bigbank.com/AccountService# wsdl.endpoint(AccountService/AccountServiceSOAP)"/></service><reference name="StockQuoteService“ promote=“AccountServiceComponent/ stockQuoteService”> <interface.java interface="services.stockquote.StockQuoteService"/> <binding.ws port="http://www.quickstockquote.com/StockQuoteService# wsdl.endpoint(StockQuoteService/StockQuoteServiceSOAP)“# requires=“sca:confidentiality”/></reference> Confidentiality applied to
Web service binding
OpenCSA Member Section – Service Component Architecture 25OpenCSA Member Section – Service Component Architecture 25
Policy Sets Policy Sets contain concrete Policies
<policySet name="sca:userNameTokenHashPassword" provides="sca:authentication" appliesTo="sca:binding.ws">
<wsp:Policy> <sp:SupportingToken> <wsp:Policy> <sp:UserNameToken> <wsp:Policy> <sp:HashPassword> </wsp:Policy> </sp:UserNameToken> </wsp:Policy> </sp:SupportingToken> </wsp:Policy></policySet>
defines intents provided
what this policy applies to
OpenCSA Member Section – Service Component Architecture 26OpenCSA Member Section – Service Component Architecture 26
SCA Runtime
SCA PHP Container
Assigned to be hosted by SCA Java container Assigned to be
hosted by SCA CPP container
Runtime Topology
DeploymentMapping
Service Compositions
SCA Domain
bigbank.accountmanagement
bigbank.stockquote
SCA JEE Containers SCA CPP Containers…
SCA Java Containers
SCA BPEL Container
OpenCSA Member Section – Service Component Architecture 27OpenCSA Member Section – Service Component Architecture 27
Agenda
Customer scenario SCA overview SCA details Web 2.0 & SCA
OpenCSA Member Section – Service Component Architecture 28OpenCSA Member Section – Service Component Architecture 28
Web 2.0 Composite Applications
Web Server
HTML + JS
Services
“implementation.widget”- HTML + Javascript with SCA reference wiring- Access services from scripts – with async
“implementation.widget”
OpenCSA Member Section – Service Component Architecture 29OpenCSA Member Section – Service Component Architecture 29
Web 2.0 Gadgets meet SCAWeb Server
Gadget + HTML + JS
Services
“implementation.widget”
“implementation.widget”- HTML + Gadgets with SCA reference wiring- Access services from scripts – with async- Link to other on-screen gadgets
other Widgets
can be anygadget supportingmashup technology
OpenCSA Member Section – Service Component Architecture 30OpenCSA Member Section – Service Component Architecture 30
HTML & JS SCA Implementation
Store Implementation<html><head><title>Store</title>
<script type="text/javascript" src="store.js"></script><script language="JavaScript">
//@Referencevar catalog = new Reference("catalog");
//@Referencevar shoppingCart = new Reference("shoppingCart");
//@Referencevar shoppingTotal = new Reference("shoppingTotal");
function catalog_getResponse(items) {…}function shoppingCart_getResponse(feed) {…}
function init() {catalog.get(catalog_getResponse);shoppingCart.get("", shoppingCart_getResponse);
}
</script>
</head>
<body onload="init()"><h1>Store</h1>
…</body></html>
Defines references to services
Call reference operations
OpenCSA Member Section – Service Component Architecture 31OpenCSA Member Section – Service Component Architecture 31
HTML & JS Component Configuration
Store Configuration<composite name="store" … >
<component name="Store"><t:implementation.widget location="uiservices/store.html"/><service name="Widget">
<t:binding.http uri="/ui"/></service><reference name="catalog" target="Catalog">
<t:binding.jsonrpc/> </reference> <reference name="shoppingCart" target="ShoppingCart/Cart"> <t:binding.atom/> </reference> <reference name="shoppingTotal" target="ShoppingCart/Total"> <t:binding.jsonrpc/> </reference>
</component>
<component name="ShoppingCart"><implementation.java class="services.ShoppingCartImpl"/><service name="Cart">
<t:binding.atom uri="/ShoppingCart/Cart"/></service> <service name="Total">
<t:binding.jsonrpc/></service>
</component>…
</composite>
HTML & JS implementation
HTTP binding & address
Catalog service via JSONRPC
Wire
OpenCSA Member Section – Service Component Architecture 32OpenCSA Member Section – Service Component Architecture 32
Summary
OASIS SCA is a great way to build distributed services applications Compose services Develop service components Apply policies and bindings
Agile and Flexible systems
OpenCSA Member Section – Service Component Architecture 33OpenCSA Member Section – Service Component Architecture 33
Useful links Articles about SCA: http://www.infoq.com/articles/setting-out-for-sca http://www.osoa.org/display/Main/SCA+Resources
Open Source implementation of SCA: http://cwiki.apache.org/TUSCANY/
SCA Specifications in OASIS: http://www.oasis-opencsa.org/
Email address: [email protected]