Service Component Architecture samples

The product offers sample files that support Service Component Architecture (SCA) specifications. You can use these sample SCA files in business-level applications. SCA services are packaged in Java archive (JAR) files that you import as assets to the product repository and then add as composition units to business-level applications. Each sample includes detailed deployment instructions in a readme.html file.

Prerequisites for use

Important: The Service Component Architecture (SCA) programming model is stabilized in this version.

Update your applications to use different programming models. The programming models that you use vary depending on how you previously incorporated SCA in your application.

If you used SCA to create modular applications, consider using OSGi instead. For more information, see Developing OSGi applications.

If you used SCA for binding, consolidate the ways in which your application is exposed to a few standards, such as Java API for RESTful Web Services (JAX-RS) or Java Message Service (JMS). For example, use JAX-RS for application bindings; for more information, see Implementing JAX-RS web applications. To minimize the duplication of binding level implementation, structure your application to use shared code.

If you want to continue to use SCA as part of your long-term strategy, consider hosting your applications on IBM Business Process Manager.

WebSphere® Application Server Version 8.5
Important: The Oasis samples were tested with WebSphere Application Server Version 8.5. All other samples were tested with WebSphere Application Server Version 8.0 and Version 8.5.

Samples download

To use the samples, download SCA sample files from a product download site:

  1. Choose one of the following methods to download the SCA.zip file to a directory on your workstation: FTP or HTTP. You might create the /samples/sca directory path on your workstation and download SCA sample files to that directory path.
  2. From the displayed dialog, specify the target directory to which to save the compressed file and click OK.
    The SCA.zip compressed file contains sample files in the following directory structure:
    /CandyStore
    /common
    /HelloJee
    /helloworld-ws-asynch
    /helloworld-ws-asynch_Oasis
    /installableApps
    /installableApps_Oasis
    /jms
    /jms_Oasis
    /jobbankejb
    /jobbankejb_Oasis
    /MultiService
    /MultiService_Oasis
    /MyBank
    /MyBank_Oasis
    readme.html
    notices.txt
    Attention: The readme.html file contains information for installing and running the sample.

You must deploy SCA sample files as assets of a business-level application to a Version 8.5 server or cluster or to a Version 7.0 target that is enabled for the Feature Pack for SCA. The /installableApps directory contains prebuilt archives that you can deploy as assets. The other directories contain sample-specific source files, scripts, and instructions for building deployable archives.

Samples description

CandyStore (OSOA only)
The CandyStore.jar file uses the default binding, web service binding, and EJB binding and shows the use of the recursive model, and authentication and authorization over the default binding. The sample shows both the bottom-up (Java to WSDL) and top-down (WSDL to Java) approaches in developing SCA applications.

You can deploy the prebuilt CandyStore.jar file in the /installableApps directory or build a deployable JAR file.

For a description of the 10 composites in CandyStore and details on deployment, refer to /CandyStore/documentation/readme.html.

HelloJee (OSOA only)
This sample shows how to use SCA annotations within Java Platform, Enterprise Edition (Java EE) components so that these components can consume SCA services. Java EE applications can take advantage of the SCA programming model with little or no change to the application implementation code. The sample uses implementation.jee definitions to enable Java EE archives as SCA component implementations. The sample has a Java EE archive with no SCA artifact in it and a Java EE archive with a composite definition file that defines an SCA composite and components. The components use implementation.ejb and implementation.web definitions. It demonstrates how to expose EJB services as SCA services and access injected values of reference and property annotations in stateless session beans and servlets.

You can deploy the prebuilt HelloJeeEar.ear, HelloJeeEnhancedEar.ear, and HelloJeeSca.jar files in the /installableApps directory or build deployable files.

For details on deployment, refer to /HelloJee/documentation/readme.html or to the topic about using existing Java EE modules and components as SCA implementations.

helloworld-ws-asynch (helloworld-ws-asynch_Oasis)
This sample uses web services and an asynchronous translator service. The sample has three deployable archives: the client helloworld-ws-client-asynch.war and two web services, helloworld-ws-asynchclient.jar and helloworld-ws-asynch.jar. The client uses a Java ServerPages (JSP) file to obtain an SCA composite context and invoke the HelloWorldClient service over an SCA default binding. The client service then invokes the HelloWorld service over a web services binding. After the service is invoked, the service does a callback to the client service. The client JSP waits for 5 seconds for the callback to complete and then displays the callback result.

You can deploy the prebuilt helloworld-ws-asynch.jar, helloworld-ws-client-asynch.war, and helloworld-ws-asynchclient.jar files in the /installableApps directory or build deployable files.

For a description of the JAR files and details on deployment, refer to /helloworld-ws-asynch/documentation/readme.html. For detailed instructions on deploying the helloworld-ws-asynch.jar file in a business-level application, refer to "Example: Creating an SCA business-level application with the console" and "Example: Creating an SCA business-level application with scripting" in the information center.

JMS (JMS_Oasis)
The JMS samples show how to invoke an SCA component service using a Java Message Service (JMS) client. There are three JMS binding samples:
  • TwoWay, which provides a two-way method that returns a value
  • TwoWay-OneWay, which provides a two-way method that invokes LoggingService over a one-way method to log the message to the server SystemOut file
  • TwoWay-OneWay-Callback, which provides a one-way method that makes a callback to the HelloServiceComponent POJO component

Also provided with the JMS binding samples are a POJO component and a thin client:

  • HelloServiceComponent, a simple POJO component that receives the JMS message through JMS service binding, runs the POJO component method, and returns the result back to the caller as a response message
  • thinClient, a non-SCA, JMS client packaged within the jms-client.jar file that invokes the POJO HelloService SCA service by sending a JMS message to the JMS message provider

You can deploy the prebuilt jms-callback-service.jar, jms-twoway-oneway-service.jar, and jms-twoway-service.jar files in the /installableApps directory or build deployable files.

For details on building JMS sample artifacts, creating JMS resources for the samples and deploying the samples, refer to /jms/documentation/readme.html.

JobbankTargetEJBApp (JobbankTargetEJBApp_Oasis)
This sample shows how a Java EE client, JobbankClientApp.ear, can invoke an SCA component, jobbankejb.jar, using a remote EJB service binding as well as how a component with an EJB reference binding can invoke a remote external EJB, which is in JobbankTargetEJBApp.ear. The stateless session bean binding is a protocol binding that provides the ability to integrate SCA with EJB based services. The SCA support is in jobbankejb.jar.

You can deploy the prebuilt JobbankClientApp.ear, jobbankejb.jar, and JobbankTargetEJBApp.ear files in the /installableApps directory or build deployable files.

For a description of the files and details on deployment, refer to /jobbankejb/documentation/readme.html.

MultiService (MultiService_Oasis)
This sample shows service composition using existing services. The MultiService sample wires to several existing samples:
  • Stock Quote, WebServicesSamples.ear
  • HelloWorldAsync, helloworld-ws-asynch.jar
  • JobbankTargetEJBApp, JobbankTargetEJBApp.ear
  • EJB Counter, EJB3CounterSample.ear

You can deploy the prebuilt Multiservice.jar, MultiService.war, helloworld-ws-asynch.jar, and JobbankTargetEJBApp.ear files in the /installableApps directory or build deployable files.

You can deploy the prebuilt WebServicesSamples.ear and EJB3CounterSample.ear files in the /installableApps directory.

There is an option in the sample to implement the SCA service as an OSGi application with SDO data bindings.

For details on deployment, refer to /MultiService/documentation/readme.html.

MyBank (MyBank_Oasis)
This sample shows how to create an SCA application that uses JAXB following a top-down approach. You use AccountService.wsdl to generate JAXB classes that provide a data binding between XML and Java files. You then use a reference on the client side WAR file to wire to the Account Service over the web service binding.

There is also an option to implement the SCA service as an OSGi application with SDO data bindings.

You can deploy the prebuilt mybank-accountservice.jar and mybank-client.war files in the /installableApps directory or build deployable files.

For details on deployment, refer to /MyBank/documentation/readme.html.

Concept topic    

Terms and conditions for product documentation | Feedback

Last updated: January 29, 2018 04:57 AM GMT-06:00
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-mp&topic=sample_sca
File name: sample_sca.html