IBM Rational Software Masterclass How to develop Services in-the-cloud using SoaML Richard Bakker

IBM Rational Software Masterclass
How to develop Services in-the-cloud
using SoaML, week 3
Richard Bakker
CTP
January 18th, 2011
© 2009 IBM Corporation
IBM Software Group | Rational software
Schedule
•week 1: Tuesday January 4, 2011 (room S648), 9:00-12:45, (guest lecturer: Richard Bakker,
IBM)
Tooling, Teaming & Installation. Presentation and demonstration on Rational Software
Architect and the Rational Team Concert environment. Distribution & installation of the
tools. Home work: perform the supplied tutorial; read the developerWorks articles.
•week 2: Tuesday January 11, 2011 (room S648), 9:00-12:45, (guest lecturer: Richard
Bakker, IBM)
Modeling with RSA and the SoaML extension. Working session with the teams and scope
team project, select a development process to follow. Working session where students
start modeling their solution.
•week 3: Tuesday January 18, 2011 (room P656), 9:00-12:45, (guest lecturer: Richard
Bakker, IBM)
Transforming each team’s SoaML model into an implementation. Describe the
requirements the transformation puts on the input model, elaborate the generated
implementation into a working system. After this session, the students should start with
their models and RSA and transform this into an implementation, which they test and
improve for the next two weeks.
•week 4: Tuesday January 25, 2011 (room C648), 9:00-12:45, (guest lecturer: Frans Baas,
IBM)
Introduction to the engineering of a cloud-environment; which requirements are unique to
a cloud solution and which specific software was selected to make this cloud feasible.
The case described will be the cloud that the students are utilizing.
•week 5: Tuesday February 1, 2011 (room S640), 9:00-12:45 (IBM and VU)
© 2009 IBM Corporation
IBM Software Group | Rational software
Today’s Agenda
 Service Component Architecture
 RSA – SOA Transformations
 RAD – SCA Programming tools
 Installation & Setup
– Install Rational Application Developer within current package
– Install Websphere Application Server v8
 Self-study materials
© 2009 IBM Corporation
IBM Software Group | Rational software
Open Service Component Architecture (Open SCA)
An open, emerging standard programming model
for assembling flexible SOA business solutions
from diverse, reusable service enabled IT assets
Develop interfaces
and
implementations.
Compose and W ire.
Bindings and
Intents.
RAD 7.5.2+
SCA Tools
Define, install and
run contributions on
W ebSphere
Application Server.
WAS 7 SCA
Feature Pack
© 2009 IBM Corporation
4
IBM Software Group | Rational software
Nature and Benefits of Open SCA
 Open, multi-vendor programming model designed for SOA.
 Emerging standard thru OASIS.
 Extends, exploits and complements existing standards.
 Unifying framework for assembling services from diverse assets.
 Formal representation of services and their interdependencies.
 Embraces heterogeneity – Strength and agility thru diversity.
 Rapid integration and Loose Coupling of components into
applications.
 Flexible assembly model – Swap implementations in or out.
 Separation of concerns in multiple dimensions.
 Diverse, extensible implementations, bindings and data.
 Inversion of Control thru dependency injection and reflection.
 Asynchrony built into the programming model.
 Declarative abstract Intents and concrete Policy.
 Simplification for developers, integrators and deployers.
© 2009 IBM Corporation
5
IBM Software Group | Rational software
What SCA isn’t
 SCA does not choreograph services or model workflows.
– Use BPEL or other workflow languages.
 SCA is not an Enterprise Service Bus.
 SCA is not Web services
– Web services are a binding technology to SCA.
– WSDL is an interface description language to SCA.
 SCA is not tied to a specific runtime environment.
– Distributed. Heterogeneous. Large. Small.
 SCA does not force specific languages / technologies.
– Open to many languages, frameworks, technologies.
– Embrace, not replace, assets and other frameworks.
– Engage, not reject, new technology.
© 2009 IBM Corporation
IBM Software Group | Rational software
Components
Intent
*
Policy Set
Property*
Interface
•
•
Policy
WSDL
Java
…
Interface
•
•
*
Service
Component
*
*
Reference
Binding
•
•
•
•
•
•
•
SCA
WS
EJB
JMS
JCA
(JSON-RPC)
(AJAX)
…
WSDL
Java
…
Binding
Implementation
•
•
•
•
Java
Spring
BPEL
Composite
…
•
•
•
C
C++
COBOL
•
•
•
•
•
•
•
SCA
WS
EJB
JMS
JCA
(JSON-RPC)
(AJAX)
…
…
© 2009 IBM Corporation
7
IBM Software Group | Rational software
Composites
Composite
Property
Promote
Intent
Policy
Policy Set
Wire
Component
Component
Service
Reference
Implementation
•
•
•
Java
Spring
BPEL
…
•
•
•
C
C++
COBOL
…
Implementation
Composite
© 2009 IBM Corporation
8
IBM Software Group | Rational software
Contributions and Domains
Contribution Package
Contribution Manifest
Composite
Composite
Java
WSDL
Domain
Schema
Virtual Composite
Deployable Composites are
unwrapped, and
components are installed
into the Domain
© 2009 IBM Corporation
9
IBM Software Group | Rational software
Specifications
Bindings
SCA (native)
JMS
Web Service
HTTP
JSONRPC
EJB Session
…
ATOM
…
Future-proof your
investment thru the
flexible, extensible
and open nature of
SCA…
Assembly Model
Implementations
Composite
Widget
Java
EAR
Spring
CICS
…
Policies
Policy
Framework
Transaction
Policy
Integration
s
SDO
for
Java
SDO
for
SDO forJava
Java
Java EE
Integration
…
© 2009 IBM Corporation
10
IBM Software Group | Rational software
SCA Annotated Java
package service;
@Remotable
public interface HelloService
{
String hello ( String message );
}
HelloComposite
locale
Hello
Service
package service;
@Service ( HelloService.class )
public class HelloServiceImpl
implements HelloService
{
@Reference public AnotherService anotherService;
HelloService
Component
another
Service
HelloServiceImpl
String hello ( String message ) {
return anotherService.howdy(message);
}
}
© 2009 IBM Corporation
11
IBM Software Group | Rational software
SCA Composite XML
HelloComposite
locale
<?xml version="1.0" encoding="ASCII"?>
<composite name=“HelloComposite"
Hello
HelloService
Service
Component
xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://foo.com">
<component name=“HelloServiceComponent">
HelloServiceImpl
<property name=“locale">
...
</property>
<service name=“HelloService“>
...
</service>
<reference name=“anotherService“>
...
</reference>
<implementation.java class="services.HelloServiceImpl"/>
</component>
</composite>
another
Service
© 2009 IBM Corporation
12
IBM Software Group | Rational software
Qualities of Service – Intents and Policies
requires="authenti
cation"
Composite
Lookup
Component
WebService
Binding
Policies
Interaction
Intent
Implementation
Intent
Interaction
Intent
<component name=“Component”>
<implementation.java class=“...”/
>
<service name=“MyService”>
<interface.java
interface=“...”/>
<binding.ws
requires=“authentication” .../>
</service>
</component>
Policy Set
requires="authenti
cation"
WS-Policy
Policy
Policy
© 2009 IBM Corporation
13
IBM Software Group | Rational software
Today’s Agenda
 Service Component Architecture
 RSA – SOA Transformations
 RAD – SCA Programming tools
 Installation & Setup
– Install Rational Application Developer within current package
– Install Websphere Application Server v8
 Self-study materials
© 2009 IBM Corporation
IBM Software Group | Rational software
What is Model Driven Development?
Visualize
Use
Transform
© 2009 IBM Corporation
IBM Software Group | Rational software
RSA 7.5.4 support for service solution design and development (3)
 Transforms
– Create service artifacts from service model
• UML to XSD
• UML to WSDL (and XSD)
• UML to SOA
 XSD, WSDL, BPEL, SCDL components
 Content created in WID-consumable Eclipse projects
• UML to SCA
 XSD, WSDL
 SCA composites specifications
 Service-aware Java code for interfaces
 Java code for skeleton component implementations
 Content created in SCA Eclipse project consumable by RAD’s SCA tooling
© 2009 IBM Corporation
IBM Software Group | Rational software
Transformations Extensions
Source
Transformation
Output
Extension
More
output
© 2009 IBM Corporation
IBM Software Group | Rational software
SCA Transformation Source
 UML models with SoaML profile are recommended to be used as
source for the transformation.
 Consume existing code using the Visualizers
– Java interfaces
– Java classes
– XSD Type
– WSDL Port Types
 Transformation source can be one or multiple of
– UML model
– UML Component
© 2009 IBM Corporation
IBM Software Group | Rational software
UML to SCA Mapping (for main elements)
Component
With Participant
A part in
a component
Service point/
Request point
Ports
SCA
Composite
SCA
Component
SCA Service/
Reference
For more complete mapping, please check
http://publib.boulder.ibm.com/infocenter/rsawshlp/v7r5m0/index.jsp?topic=/com.ibm.xtools.transform.uml2.sca.doc/topics/r_usca_map.html
© 2009 IBM Corporation
IBM Software Group | Rational software
Implementation
 UML to SCA Transformation provides implementation generation for
both Java and Composite.
 The transformation is providing an extension point that user can
implement to have a new implementation type or even to override the
current generation.
 For parts of component type that has structure diagrams ( or has a
participant stereotype), the transformation will create a composite for
the type and make it the implementation for the component
generated from this part.
 Otherwise, the transformation will generate a java implementation for
component. Implementing all the service interfaces and having
correct references to the request interfaces.
© 2009 IBM Corporation
IBM Software Group | Rational software
Interfaces

UML to SCA Transformation provides generating Java interfaces and
WSDL port Type. It also creates all required artifacts ( java classes,
XSD types, Uses ws import to generate code for the wsdl port types
and use it to generate the implementation) .

The transformation is providing another extension point that user can
implement to have a new Interface type or even to override the
current generation.

If the UML interface has no stereotype or Java stereotype, the
transformation will generate a java interface and use it in all services/
references.

If the UML interface has WSDL or Remote stereotype, the
transformation will generate a wsdl port type for the interface, will
use WSImport to generate Java code for the interface and use this
java code in any implementation generation.
© 2009 IBM Corporation
IBM Software Group | Rational software
Sample UML-to-SCA Output (1)
Service-aware
implementations for
interfaces
SCA component specs
(and skeleton
implementations,
depending upon modeling
details)
Supporting XSDs and
WSDLs
© 2009 IBM Corporation
IBM Software Group | Rational software
Example for the generated implementation
© 2009 IBM Corporation
IBM Software Group | Rational software

Free generated artifacts.
© 2009 IBM Corporation
IBM Software Group | Rational software
Advantages of the Transformation
 Reusability
– Same model can be used to generate different output using different transformations (
Classic SCA, Open SCA .. )
 Extensibility
– Can extend to generate more implementation type
– Can extend to add more output ( example it to generate test client for each composite)
 Supports incremental development
– After running the transformation, add contents to the generated sca project, you can go
back to the model and do changes then rerun the transformation. The transformation
should be able to merge the new contents with the changes you already added or at
least will show a visual merge dialog to do the merge manually.
© 2009 IBM Corporation
IBM Software Group | Rational software
Current Limitations
 Only supports Java/Composite implementation.
– You will need to develop your own extension to have different implementation type
 Doesn’t generate the binding
– So far, there was no way to model / generate the binding, so we only generate WS
binding.
 Doesn’t interact with existing SCA Composite
– Although the transformation can reuse existing java/wsdl/xsd artifacts, there is no way
so far to model a service model with interactions to existing composites.
 Model validation is poor. The transformation only have few constraints
that doesn’t capture all possible errors in the generated code.
 Wrong modeling will generate code with errors. For example If the
user has a Participant without a structure diagram, the transformation
will generate a composite with only services/references which will
cause compilation errors.
© 2009 IBM Corporation
IBM Software Group | Rational software
Today’s Agenda
 Service Component Architecture
 RSA – SOA Transformations
 RAD – SCA Programming tools
 Installation & Setup
– Install Rational Application Developer within current package
– Install Websphere Application Server v8
 Self-study materials
© 2009 IBM Corporation
IBM Software Group | Rational software
SOA Development in RAD
Implement
M anage
Explore
Assemble
Package
Create
Run
Debug
Configure
28
© 2009 IBM Corporation
IBM Software Group | Rational software
Create Components
 Use New SCA Component wizard to
create a component with Java or
Composite implementation
 Start from Java interface or WSDL
interface
 Start from Java implementation or
Composite implementation
 More implementation types can be
supported by extenders
 RDz 7.6 + CICS TS 4.1 open Beta: CICS
components.
29
© 2009 IBM Corporation
IBM Software Group | Rational software
Assemble Components into Composites
 Define and configure SCA components
 Expose services with a variety of
bindings
 Define references to other services
with a variety of bindings
 Wire component references to
component services
30
© 2009 IBM Corporation
IBM Software Group | Rational software
Package Composites into a Contribution
 Contributions, composites and
components are organized into a
logical navigation view
 Add or remove composites to or from
a contribution.
 Add, edit or remove imports/exports in
a contribution.
 Validate the contribution against
specifications and runtime
requirements
31
© 2009 IBM Corporation
IBM Software Group | Rational software
Navigate SCA artifacts
 SCA artifacts are presented in a
logical view under the SCA Content
node
 Applicable actions can be launched
from an artifact
 Physical files are hidden by default
32
© 2009 IBM Corporation
IBM Software Group | Rational software
Deploy a Contribution to Runtime
 Export a contribution into a
deployable archive
 Add/Remove SCA
contributions to/from W AS
runtime
 Test SCA contributions
 Debug SCA contributions
33
© 2009 IBM Corporation
IBM Software Group | Rational software
Manage deployed contributions
 Configure resources
 Attach policy sets
 Trouble shoot deployed
contributions
 Deploy exported
contributions
34
© 2009 IBM Corporation
IBM Software Group | Rational software
Configure SCA Tools
 Import and export settings
 Composite editor diagram
preferences
 Server integration settings
 Spring configuration
 Validation rules
35
© 2009 IBM Corporation
IBM Software Group | Rational software
Consume a service in an SCA application
Preconditions:
 In the same SCA domain
Composite
Reference and service in
the same composite
Composite
Composite
Reference and service in
the different composites
© 2009 IBM Corporation
IBM Software Group | Rational software
Consume a service in a non-SCA application
Web Applications
Web Service
Client Applications
SCA binding
WS binding
Java EE (EJB)
Applications
EJB binding
JMS Applications
JMS binding
Web 2.0
Applications
ATOM binding
Implementation
© 2009 IBM Corporation
IBM Software Group | Rational software
Consumption examples
Composite
SCA Application
SCA binding
Composite
Web Application
Web Service
Client Application
SCA binding
WS binding
© 2009 IBM Corporation
IBM Software Group | Rational software
Consume the SCA service in an SCA application
 1. Create an SCA reference on the
component where you would like to use
the service
 2. Wire the reference to the service
3. Use it in the
implementation
© 2009 IBM Corporation
IBM Software Group | Rational software
Consume the SCA service in a Web application
1. Right click on the Web
project and add SCA
support to the Web
project
2. Get the Java interface of
the service
3. Use CompositeContext in the Servlet to get and use
the service
CompositeContext compositeContext = CurrentCompositeContext.getContext();
HelloService helloService = (HelloService) compositeContext.getService(
HelloService.class, "HelloWorldComponent/HelloService");
© 2009 IBM Corporation
IBM Software Group | Rational software
Consume the SCA service in a Web Service Client application
1.
Generate a Web service
client from the WSDL
interface
© 2009 IBM Corporation
IBM Software Group | Rational software
Consume the SCA service in a Web Service Client application (cont’d)
2.
Use the Web service by the generated proxy in your Java code
3.
Or use Web Services Tools to generate JAX-WS JSPs to use the Web service
© 2009 IBM Corporation
IBM Software Group | Rational software
Today’s Agenda
 Service Component Architecture
 RSA – SOA Transformations
 RAD – SCA Programming tools
 Installation & Setup
– Install Rational Application Developer within current package
– Install Websphere Application Server v8
 Self-study materials
© 2009 IBM Corporation
IBM Software Group | Rational software
Self-study materials
 Reading:
– Whitepaper: Introducing SCA
– Transforming UML models into SCA Artifacts
– Developing SCA Applications
 SCA tutorials:
– HelloWorld
– Account services
© 2009 IBM Corporation
IBM Software Group | Rational software
Learn more at:
IBM Rational software
Rational launch announcements
Rational Software Delivery
Platform
Jazz.net
Accelerate change & delivery
Deliver enduring quality
Enable enterprise modernization
Ensure Web security & compliance
Improve project success
Manage architecture
Manage evolving requirements
Small & midsized business
Targeted solutions
Rational trial downloads
developerWorks Rational
IBM Rational TV
IBM Business Partners
IBM Rational Case
Studies
© Copyright IBM Corporation 2009. All rights reserved. The information contained in these materials is provided for inf ormational purposes only, and is provided AS IS w ithout w arranty of
any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherw ise related to, these materials. Nothing contained in these materials is intended to, nor
shall have the effect of, creating any w arranties or representations f rom IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use
of IBM softw are. References in these materials to IBM products, programs, or services do not imply that they w ill be available in all countries in w hich IBM operates. Product release dates and/or
capabilities referenced in these materials may change at any time at IBM’s sole discretion based on market opportunities or other f actors, and are not intended to be a commitment to future product
or feature availability in any w ay. IBM, the IBM logo, Rational, the Rational logo, Telelogic, the Telelogic logo, and other IBM products and services are trademarks of the International Business
Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.
© 2009 IBM Corporation
IBM Software Group | Rational software
RAD Web Services Tools
IBM Extensions for WebSphere Application Server
Frameworks
Tools
Implementations
Creation
Wizards
Web Services Explorer
Apache Axis 2.x
Editors
(WSDL, Schema)
Apache Axis 1.x
Private
UDDI
Service
Policy
Sample JSP Generator
Validators
(WSDL, Schema)
Eclipse
© 2009 IBM Corporation
IBM Software Group | Rational software
Web Services Tools – Editing and Validation
 WSDL and Schema Editors
 WSDL and Schema Validators
– Structured (XML) source view.
– WS* specification validation.
– Graphical design view.
– WS-I profile validation
– Common starting point for “top down” creation
of Web services beginning with their
descriptions.
•
And WS-I SOAP traffic validation.
© 2009 IBM Corporation
IBM Software Group | Rational software
Web Services Tools – JAX-WS and JAXB
 Annotation proposals.
 Annotation code assist.
 Annotations Processing for advanced
validation, including Java / WSDL
alignment.
 Annotations View with actual and
implied attributes.
© 2009 IBM Corporation
IBM Software Group | Rational software
Web Services Tools – Web Services Explorer
 Web Services Explorer
– Rich Web application
integrated into Eclipse.
– Interactive invocation of Web
services described with WSDL
and Schema.
– Publication and discovery of
WSDL to and from UDDI
registries.
 Universal Test Client
– For testing Java client proxies
to Web services.
© 2009 IBM Corporation
IBM Software Group | Rational software
Web Services Tools – Creation and Consumption
 Wizards for generating and deploying Web
services and Web service clients to
WebSphere Application Server.
–
Top-down from WSDL to skeletal Java classes or EJBs.
–
Bottom-up from plain Java or EJBs.
 For Web developers: Discovery and
composition of Web services in Page
Designer.
 JAX-WS and JAXB annotation based
programming models.
 Services view.
© 2009 IBM Corporation
IBM Software Group | Rational software
Web Services Tools – Deployment Descriptors
 Deployment descriptor editing in J2EE or, optionally, Java EE.
© 2009 IBM Corporation
IBM Software Group | Rational software
Web Services Tools – Extensions for WebSphere
 Web Service runtimes (Wizard extensions).
 Support for Editing JAX-WS / JAXB Annotations.
 JAX-WS Annotations Processor.
 Validation and Quick Fixes.
 JAXB Schema to Java Wizard.
 Schema Library (generate data classes once for sharing).
 JSR-109 1.2 Support.
 Service Policy Integration (WS-I profiles).
 Manage Policy Attachments Wizard.
 WS-Policy and WS-Metadata Exchange support.
 UDDI Registry Configuration Wizard.
 SOAP / JMS.
© 2009 IBM Corporation