Developing Service Component Architecture applications using Rational Application Developer

This article describes how to develop and access SCA applications using Rational Application Developer Version 8 with a sample application. It begins with some basic definitions and frequently used terms, next we describe the pre-requisites and references links before start developing SCA applications. Next explains with the wizards of the Rational Application Developer to create a sample SCA application, create different supported bindings for SCA Services and SCA References like default SCA binding, web services binding, and EJB bindings. The article concludes by describing how Servlet client application accesses the SCA sample application.


Lokanadham Nalla (, TXSeries Developer, IBM

Lokanadham Nalla is a TXSeries Developer located in India Software Labs, Bangalore, India with expertise in Java, J2EE and SOA technologies.

27 December 2010

Also available in Japanese Portuguese


Service Component Architecture (SCA) is a programming model for SOA based application development. The specifications for implementing the SCA programming model are provided by, an open SOA collaboration from industry leaders including IBM. The SCA Feature Pack for WebSphere Application Server implemented many of the specifications provided by the to provide SCA programming model for Java/JEE developers.

Rational Application Developer (RAD) Version 8 provides the tooling facility to develop SCA applications. This article describes how to develop SCA applications using RAD with a sample application demonstrating supported SCA bindings. We begin with the basic definitions of SCA, required software, developing a simple SCA application and finally using it from Servlet client applications.

Basic SCA definitions

This section describes SCA terminology extracted from the RAD 8 Information Center.

A well-bounded runtime entity that contains a set of service components wired together to provide a realm of business function that is meaningful to a business.

A package of file artifacts, including a contribution metadata document and usually one or more composites, collected together for deployment to an SCA domain.

A configuration of an implementation that provides or consumes services

A unit of assembly of components. Composites may be deployed to a domain and become known as deployable composites, or used to implement other components and become known as implementation composites or inner composites.

A declaration of a service or set of business operations offered by a component. A service is characterized by an interface and by one or more protocol bindings.

A declaration of a service or set of business operations consumed or required by a component. A reference is characterized by an interface and by one or more protocol bindings.

A logically cohesive set of operation signatures describing a service provided or a service reference consumed. Though other languages are allowed through the extensibility of SCA predominantly, interfaces are written in either Java or WSDL.

A description of an access mechanism to a service or from a reference. A service binding describes how a service is published at runtime and how external entities can communicate with it. A reference binding describes how a reference connects to and communicates with external services.

A dependency from a component reference to a component service

A unit of language-specific software technology, such as a Java class or an SCA composite, that provides the business logic beneath a component.

A data value computed and injected by a component into an implementation

A declaration of an abstract policy or quality of service required of a component, service or reference. Intents relieve the developer of the burden of having to understand frequently complex concrete policies.

A concrete assertion of some capability, constraint or other non-functional requirement to be honored by a component, service or reference.

Policy Set:
A collection of mutually compatible concrete policies that can be applied to a specific binding type or implementation type. Although policy sets can be attached to components, services and references at development time, SCA recommends a late binding approach in which policy sets and bindings are selected at deployment time.


This section provides information on the installation of Rational Application Developer 8.0 for WebSphere Application Server software.

  • The Information Center for IBM Rational Application Developer 8.0 provides additional details on installing Rational Application Developer for WebSphere Software.
  • Ensure the "Service Component Architecture development tools" feature is enabled from the list of features during RAD installation using IBM Installation Manager Software as highlighted in Figure 1.
Figure 1. Service Component Architecture development tools
Service Component Architecture development tools
  • Also ensure "Feature Pack for Service Component Architecture" is enabled under WebSphere Application Server section as highlighted in figure 2 below.
Figure 2. Feature Pack for Service Component Architecture
Feature Pack for Service Component Architecture

Installing SCA Feature Pack

This section provides information on SCA Feature Pack installation if the WebSphere Application Server is installed external to RAD.

To install the Service Component Architecture (SCA) Feature Pack, you need to complete the instructions provided in the section, "Installing and uninstalling the feature pack on distributed operating systems" in the WebSphere Application Server Information Center.

Developing SCA applications using RAD

This section describes the tasks required to develop a sample SCA calculator application using RAD wizards.

  • Create SCA Project
  • Create SCA Composite
  • Create SCA Component
  • Adding service or reference to a Component
  • Apply binding to a service or reference
  • Component implementation
  • Create Contribution

Creating a SCA project

This section describes how to create a new SCA project using RAD wizards. From RAD workspace, open menu options File > New > Other. Select SCA Project as shown in Figure 3.

Figure 3. Create SCA Project
Create SCA Project

Specify project name as 'CalculatorProject' as shown in Figure 4 below and make sure 'Implementation Types for SCA Components' section Java checkbox is enabled.

Figure 4. SCA Project Options
SCA Project Options

Click Next > Finish buttons to create CalculatorProject.

Create SCA Composite

Expand the CalculatorProject > SCA Content from the Enterprise Explorer window and right click on Composites, select New > SCA Composite as shown is Figure 5.

Figure 5. Create SCA Composite
Create SCA Composite

Specify Composite name as CalculatorComposite and Target namespace as http://calculator as shown in Figure 6 and click on Finish button.

Figure 6. SCA Composite options
SCA Composite options

Create SCA Component

Expand CalculatorProject > SCA Content > Composites > http://calculator > and right click on CalculatorComposite. Select option New > SCA Component as shown in Figure 7.

Figure 7. Create SCA Component
Create SCA Component

Specify Component name as MainComponent as specified in Figure 8 and click on Finish button.

Figure 8. SCA Component options
SCA Component options

MainComponent image is created on the composite diagram as shown in Figure 9.

Figure 9. MainComponent

Adding service or reference to a Component

Right click on the MainComponent image to create a service and a reference as shown in Figure 10 and Figure 11. Name the service as CalculatorInterface and the reference as addReference.

Figure 10. Adding a service
Adding a service
Figure 11. Adding a reference
Adding a reference

There are two approaches for SCA service implementation, top-down and bottom-up. Top-down development is used when starting with an existing WSDL. Bottom-up development is used when starting from existing Java code. The sample uses bottom-up approach where service Interface type is set to Java.

  • Create package under src folder of the CalculatorProject.
  • Create a new Java interface as shown in Listing 1.
Listing 1. Service Interface


public interface CalculatorInterface {
	int calculate(int firstValue, int secondValue, String operation);
  • Make sure you have Remotable annotation is added to the interface
  • Set the service Interface property to as highlighted in Figure 12.
Figure 12. Set service interface
Set service interface

Note: If top-down approach is used, select Interface type as WSDL and specify the location of the WSDL in Interface.

Apply binding to a service or reference

The SCA Feature Pack supports following bindings:

  • Web service
  • Atom
  • HTTP
  • EJB
  • JMS
  • SCA

Users can choose to apply these binding depending on the type of client they are using. If the client application is a web service client, then web service binding can be applied. If the client application is EJB client, EJB bindings can be applied.

In the Calculator sample application, the web service binding is used so that the client Servlet application can use the generated WSDL file for communication with Calculator SCA application. Follow the below steps for applying web service binding to the CalculatorInterface service.

  • Right click on the CalculatorInterface service, select Show Properties View option from the menu panel, which displays the properties window as shown in bottom panel of Figure 13.
  • Select Binding option from the left pane of the properties window.
  • List of SCA Feature Pack supported bindings are displayed after clicking on Add button on the Bindings as shown in Figure 13.
  • Select web service from the list of bindings and click 'OK'. Now the web service client APIs can be used to invoke the SCA Calculator application.
  • When the Calculator application is deployed into WebSphere Application Server, It generates a WSDL file and it can be located using following URL: http://server-name:http-port/MainComponent/CalculatorInterface?wsdl.
Figure 13. Service properties and bindings
Service properties and bindings

Similarly bindings can also be applied for a reference.

Component implementation

Right click on the MainComponent and select "Regenerate implementation" option as shown in Figure 14.

Figure 14. Generate Implementation
Generate Implementation
  • Choose Java from the list of "Implementation Type" in the next window.
  • Click the Next button and observe the implementation class it is going to be generated as highlighted in Figure 15.
  • Click on the Finish button to generate the implementation class
Figure 15. Implementation class configuration
Implementation class configuration

Listing 2 below shows the generated implementation class.

Listing 2. Implementation class


@Service (CalculatorInterface.class)
public class CalculatorInterfaceImpl implements CalculatorInterface {

    public int calculate(int firstValue, int secondValue, String operation) {
        return 0;


The created reference needs to be defined in the component implementation. In other words, we mandated MainComponent to have reference and it depends on some other component's service. So a new component (AddComponent) with a service need to be created and map the MainComponent reference to the service of AddComponent as highlighted in Figure 16.

Figure 16. Wiring MainComponent reference to AddComponent service
Wiring MainComponent reference to AddComponent service
  • The steps for creating AddComponent and service are similar to MainComponent.
  • The MainComponent implementation should have reference definition as shown in Listing 3.
Listing 3. Reference definition
AddInterface addInterface;

    public  void setAddReference(AddInterface addInterface){
  • MainComponent reference and AddComponent service should be bound to SCA binding as shown in properties window of Figure 17. This is not mandatory by default, if not chosen any bindings for a service or reference, default SCA bindings are applied automatically.
  • The AddComponent implementation class should be as shown in Listing 4.
Listing 4. AddComponent implementation

@Service (AddInterface.class)
public class AddInterfaceImpl implements AddInterface {
    public int add(int firstValue, int secordValue) {
        return firstValue+secordValue;

Similarly SubstractComponent, MultiplyComponent and DivisionComponent and its services can be created and wired to the MainComponent's different references. Upon creating all the above components, the Calculator SCA composite diagram should look as shown in Figure 17.

Figure 17. Calculator SCA composite diagram
Calculator SCA composite diagram

Create Contribution

Contribution can be created for the Calculator composite using RAD wizards as shown in Figure 18.

Figure 18. Creating Contribution
Creating Contribution

Once the contribution is created, it can be added to deploy on the local WebSphere Application Server instance as shown in Figure 19 and Figure 20.

Figure 19. Adding/Removing projects
Adding/Removing projects
Figure 20. Adding Calculator project
Adding Calculator project

Note: The contribution can also be exported as SCA archive file for deployment into WebSphere Application Server external to the RAD.

Servlet client using SCA Calculator application

This section describes how to use the Calculator SCA application MainComponenent service from a Servlet application.

Create the WSDL stub classes using following steps:

  1. Open File > New > Other and select Web service client project.
  2. Specify http://server-name:http-port/MainComponent/CalculatorInterface?wsdl in the service definition
  3. Specify the Develop client as highlighted in Figure 21 and click Next button.
Figure 21. Web service client
Web service client
  1. Specify the package as shown in Figure 22 and click on Finish.
Figure 22. Specify stub classes package
Specify stub classes package

The Servlet can use the code as highlighted in Listing 5 below.

Listing 5. Web service stub APIs
CalculatorInterfaceService service = new CalculatorInterfaceService();
CalculatorInterface ci = (CalculatorInterface) service.getCalculatorInterfacePort();
int result = ci.calculate(firstValue, secondValue, operation);

Working with supplied sample

This section describes the steps required to deploy the Calculator SCA sample and deploying the SCA Servlet client application and working with it.

  • Download and extract the file located in the download section.
  • Run the following command to deploy the SCA application as BLA and also deploying the Servlet client.
    • Unix platforms –f
    • Windows platform
      wsadmin.bat –f
  • To undeploy the samples run the following command
    • Unix platforms –f
    • Windows platform
      wsadmin.bat –f
  • To run the sample application open the following URL: http://server-name:http-port/SCAClient


Sample downloads for this articleDoNotLeaveThisLink.zip10KB



developerWorks: Sign in

Required fields are indicated with an asterisk (*).

Need an IBM ID?
Forgot your IBM ID?

Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.


All information submitted is secure.

Dig deeper into SOA and web services on developerWorks

Zone=SOA and web services, Rational, DevOps
ArticleTitle=Developing Service Component Architecture applications using Rational Application Developer