About Me
Facebook
Facebook
Linked In
Linked In
Twitter
Twitter
YouTube
YouTube
Google +
Google +

Wednesday, August 14, 2013

Build & Integrate the Applications with SCA binding in WPS

Introduction:    
            Service Component Architecture (SCA) provides a simple, powerful programming model for implementing applications based on the Open SCA specifications. The SCA modules of WebSphere Process Server use import and export bindings to interoperate with Open SCA services.
            SCA application invokes WebSphere Process Server SCA applications using an export binding. An Open SCA application receives a call from a WebSphere Process Server SCA application using an import binding.
           The SCA binding is used for invocations between SCA modules. This binding type is the simplest to configure and provides seamless integration between modules. An SCA binding provides a consistent means for communicating across module boundaries in a WebSphere Process Server or WebSphere ESB environment. The underlying protocol used by the SCA binding is selected automatically based on the invocation pattern used by the client module.
Overview:   
            SCA provides four invocation patterns.
  • Synchronous - Client issues a request and waits for the response.
  • Asynchronous one-way - Client issues a request and a response is not expected.
  • Asynchronous deferred response - Client issues a request and the response will be requested by the client at a later point in time.
  • Asynchronous call back - Client issues a request and the target will call a service implemented by the client with the response.
            The WebSphere Process Server or WebSphere ESB SCA runtime will decide when to use the underlying system integration bus (for asynchronous invocation patterns), or RMI/IIOP (for the synchronous invocation pattern).
          The SCA binding capability is driven by the export. During the installation process of an SCA module to a WebSphere Process Server, the necessary support artifacts are created:
For asynchronous invocations, cell scoped service integration bus (SIBus) destinations are created in the SCA.SYSTEM.<cell name>.Bus.
          For synchronous communication, a cell scoped name space binding those points to the module session bean is created; a module session bean is a stateless session bean that is used by the module for a variety of purposes, such as unit of work boundaries, security configuration, and so on.
          The import and export files work together, where the import file contains important information about the export, helping any number of clients to import a target service. Using the information in the .import file and the invocation pattern (sync or async) the SCA runtime identifies whether to use a SIBus destination or a WebSphere name space binding.
       Here we are going to learn, how to creating import, export and configuring SCA binding for those import, export. He are we are going to develop a simple application for Order creation and approval.
Implementation:   
          Here we are going to build the application. We need to follow the steps to complete this application.
  • Create an EAI_Librry.
  • Create and Implement EAI_OrderApproval Module.
  • Create and Implement EAI_OrderRequest Module.
  • Test the Application.
Create an EAI_OrderLibrry:
       Select File àNew àLibrary, give name as EAI_Library then click on finish.
Create a business Object called OrderRequest.
Right click on EAI_Library, New àBusiness Object, give the name as ‘OrderRequest’ then click on finish. Add the following fields to business Objects as shown below.
Create a business Object called OrderRespons as shown below.
Create a business Object called OrderApproveRequest as shown below.
Create a business Object called OrderApproveResponse as shown below.
Create an Interface called OrderRequestInterface.
Right click on EAI_Library, New àInterface, give the name as ‘OrderRequestInterface’ then click on finish. Add the operation to Interface as shown below.
Create an Interface called OrderApproveInterface as shown below.
Create and Implement EAI_OrderApproval Module:
          Right click on Business Integration view, select new àModule.
        Give the name as ‘EAI_OrderApprove’, click on next then select EAI_Library as required libraries, then click on finish.
Drag and drop a Java component into EAI_OrderApprove - Assembly diagram and rename as ‘OrderApprove’.
Add OrderApproveInterface to OrderApprove java component as an Interface.
Right click on OrderApprove select Add à Interface, select OrderApproveInterface and click on ok.
Generate an export for access other SCA services. Right click on OrderApprove java component, select Generate Export à SCA Binding. This will available for access SCA applications.
Now we need to implement the OrderApprove Java component. Double click on OrderApprove and use the following code into approveOrder (DataObject request).
System.out.println("***** Entering into OrderApprove () *****");
// create approveOrder return data object using the BO factory
BOFactory bof =      (BOFactory)ServiceManager.INSTANCE.locateService("com/ibm/websphere/bo/BOFactory");
DataObject Response = bof.create("http://EAI_Library","OrderApproveResponse “);
String Status =null;
      String Remarks = null;
      if(request.getString("ItemID").contains("ITM")){
            Status = "APPROVED";
            Remarks = "Successfully order approved";
      }else{
            Status = "REJECTED";
            Remarks = "rejected the order";
      }
      Response.setString("OrderID", request.getString("OrderID"));
      Response.setString("Status",Status);
      Response.setString("Remarks",Remarks);
      System.out.println("***** Exit from OrderApprove () *****");
      return Response;
Create and Implement EAI_OrderRequest Module
Right click on Business Integration view, select new àModule.
Give the name as ‘EAI_OrderRequest’, click on next then select EAI_Library as required libraries, then click on finish.
Drag and drop a Process component into EAI_OrderRequest - Assembly diagram and rename as ‘BP_OrderRequest’.
Add OrderRequestInterface to BP_OrderRequest as an Interface. Right click on BP_OrderRequest select Add àInterface.
Select OrderRequestInterface then click on Ok.
Add OrderApproveInterface to BP_OrderRequest as a Reference. Right click on BP_OrderRequest select Add àReference.
Select OrderApproveInterface, give name as OrderApproveInterfacePartner click on Ok.
Drag and drop an Import component into EAI_OrderRequest - Assembly diagram and rename as ‘OrderApprove’.
Add OrderApproveInterface to OrderApprove’ as an Interface. Drag a wire from BP_OrderRequest to OrderApprove. The EAI_OrderRequest - Assembly diagram is shown below now.
Right click on OrderApprove import and select Generate Binding à SCA binding. It will be used for invoke external services using SCA binding
Select OrderApprove import component, select Properties àBinding, click on browse, select OrderApprovalExport then click on Ok.
OrderApprovalExport is which we have exported as export in EAI_OrderApproval assembly diagram. So we are going to invoke OrderApprove java component from BP_OrderRequest using SCA binding.
Now the properties are look like below.
Now double click on ‘BP_OrderRequest’ Process for implement. The implementation is look like below. I will explain here each and every activity functionality and implementation.
Log Entry (Snippet): It is used for customize our messages, we can write java code and made business logic here.
Here we are going to print the log into console. Click on LogEntry activity go to properties à Details, select Java button. Write the following code as shown below.
Generate OrderID:
Here we are writing java code for generate orderID for each order.
Click on Generate OrderID activity go to properties àDetails, select Java button. Write the following code as shown below.
Set Request for Order Approve (Assign): It is used for assign values to variables.
Here we are setting input for Order Approve service. Click on Set Request for Order Approve activity goes to properties àDetails. Select the x path as shown below.
Invoke Order Approve Service (Invoke): It is use for call external services.
Here we are using for call Order Approve Service. Click on Invoke Order Approve Service activity go to properties àDetails. Select the partner, operation and input, output parameters as shown below.
Set Response (Assign): It is used for assign values to variables.
Here we are setting response from Order approve service to OrderRespons. Click on Set Response activity go to properties àDetails. Select the x path as shown below.
Log Exit (Snippet): It is used for customize our messages, we can write java code and made business logic here.
Here we are going to print the log exit into console. Click on LogExit activity go to properties à Details, select Java button. Write the following code as shown below.
Test the Application:
Start the WebSphere process Server. Select Servers view à WebSphere Process Server v7.0 click on start the server.
Add the EAI_OrderRequest and EAI_OrderApprove modules to WebSphere process Server. Right click on WebSphere process Server v7.0 àAdd and remove projects, select EAI_OrderRequest and EAI_OrderApprove click on Add then click on Finish.
Double click on EAI_OrderRequest assembly diagram, Right click on BP_OrderRequest and select Test Component.
Enter the request parameters as shown below and click on continue.
The final output will be look like below. Here EAI_OrderRequest module will be invoked EAI_OrderApproval module using SCA binding. Find the Integrated test client flow for each activity it performed.
Find the console log for log statements which we have implemented in both the modules.
Conclusion:   
         Imports and exports enable us to expose out solutions in service-oriented fashion. In this article, you learned how to integrate SCA solutions using SCA import and exports. In future articles, we will examine integrating with other solutions using some of the other bindings such as Web services and JMS.
Downloads:  
File Name
Description
      Size
Download
SCA Binding.zip
SCA Binding Sample
25 KB
SCA Binding in WPS.pdf
SCA binding implementation in WPS
790 KB

3 comments :

nageswara rao said...

Hi basha, this is Nageswara rao, i am leaving in hyderabad, i am read the your blog it is very use full for me, i have some doubts if you don't mind give me your mail id or mobile number, my mail id nagmaram27@gmail.com, please revert me back

AMEER BASHA G said...

You just follow this blog for future updates. If you have doubts just mail me at ameerg1986@gmail.com, so that I will help you if I can.

nageswara rao said...

Thank you basha

Post a Comment

Designed By AMEER BASHA G