Integrate WebSphere Business Integration Adapters with WebSphere Process Server V6: Synchronous Request Response (OutboundRequest) scenario -- Part 2

This is the second part of a three-part series describing how to configure and setup a WebSphere® Business Integration Adapter to work in a WebSphere Process Server v6 environment. In this article, you implement a simple Java™ component that sends a synchronous request message to the WebSphere Business Integration adapter and subsequently retrieves the response that is sent back to it. The Java code uses the programming interface provided by the Service Component Architecture in WebSphere Process Server.

Seema Kumar (seemakumar@in.ibm.com), Advisory Software Specialist, IBM

Seema Kumar is an Advisory Software Specialist and is part of the WebSphere Business Partner Technical Enablement (BPTE) team in Bangalore, India. In her current role, she is involved in several customer engagements and provides valuable consulting help related to WebSphere software.



Umadevi Reddy (rumadevi@in.ibm.com), Advisory Software Specialist, IBM

Umadevi Reddy is an Advisory Software Specialist and is part of the WebSphere Business Partner Technical Enablement (BPTE) team in Bangalore, India. She works on WebSphere Process Server and WebSphere Application Server engagements.



26 April 2006

Introduction

IBM® WebSphere Business Integration Adapters (hereafter called Business Integration Adapters) provide business integration capabilities to integrate with multiple Enterprise Information Systems. You can configure these adapters to work with IBM WebSphere Process Server v6 (hereafter called Process Server) as the integration broker. Process Server in turn uses the IBM WebSphere Application Server v6 (hereafter called Application Server) as the underlying J2EE runtime environment. This article describes the OutboundRequest message interaction pattern as shown in Figure 1.

Part 1 - Event Notification (AgentDelivery) scenario describes the asynchronous event delivery message interaction pattern. It also describes how to configure the Service Integration Bus to communicate to the WebSphere MQ network using WebSphere MQ Link.

Figure 1. OutboundRequest message
OutboundRequest message

WebSphere Process Server initiated Request-Response Message (OutboundRequest)

This is a synchronous or pseudo-synchronous message from the Integration Server to the application. The calling component within Process Server is blocked until a response is received from the Business Integration Adapter. In this article, you implement an example where a Java component (hereafter referred to as a POJO - Plain Old Java Object) will send a synchronous request message to the adapter. The adapter receives this request and replies with a response to the POJO. Both the request and response messages are encapsulated within a Customer Business Object.

You can achieve the Java Message Service (JMS) messaging between the adapter and Process Server in one of the following ways:

  1. You can configure a WebSphere MQLink to establish a link between an existing WebSphere MQ Queue manager and a bus member in the Service Integration Bus.
  2. You can configure a WebSphere MQClientLink on the Service Integration Bus to communicate with the Default Messaging Provider in the Application Server.

This article explores Option 2, where a WebSphere MQClientLink configured on the Service Integration Bus will communicate with the Default Messaging Provider.

Software requirements

Install the WebSphere products listed below according to the appropriate installation instructions. For simplicity, our installation and configuration assume that one physical machine is running on Windows®. The scenario can, however, be run in a distributed environment with WebSphere Process Server and WebSphere Business Integration Adapters running on different machines. While installing WebSphere Integration Developer, make sure to install the WebSphere Process Server V6 test environment.

  • WebSphere Business Integration Adapter Framework, V2.6.0
  • WebSphere Integration Developer V6.0

Setting up the development environment

The scenario is comprised of a simple Customer Business Object interacting between the TestConnector and WebSphere Process Server. Although the TestConnector emulates a real connector, the interaction between the TestConnector and WebSphere Process server is identical to that of a real connector. Therefore, the scenario is simplified without losing technical accuracy. To use a real connector, simply swap in the Business Object and connector that you will be using.

  1. Download the files required for the adapter configuration from the provided wbia-sample.zip file.
  2. Copy TestConnectorBus.cfg and customer.xsd files to a local directory.
  3. Open the TestConnectorBus.cfg files using the Connector Configurator tool (Programs => IBM WebSphere Business Integration Adapters => IBM WebSphere Business Integration Toolset => Connector Configurator) and change the repository path to point to the location of customer.xsd file in your file system.

Launching Integration Developer with a new Workspace

  1. From the start menu, select Start => Programs => IBM WebSphere => Integration Developer V6.0 => WebSphere Integration Developer V6.0.
  2. Select a suitable workspace location.
  3. When WebSphere Integration Developer v6.0 opens, close the Welcome page.

Creating a new module

  1. Select File => New => Other.
  2. Select Module and click Next.
  3. Enter Customer for the module name and click Finish.

Importing Business Integration Adapter Artifacts using Enterprise Service Discovery

You need to import and convert the existing adapter artifacts, which include the Business Object Definitions and adapter configuration, to the format understood by Process Server. The Enterprise Service Discovery Wizard helps to generate the new artifacts in Process Server. These include the Business Objects as well as the JMS Import/Export components that are used for the inbound or outbound communication with the adapter.

  1. Right-click on the Customer folder and select New => Enterprise Service Discovery.
  2. Select WBI Adapter Artifact Importer and click on Next.
  3. At the Configure Settings for Discovery Agent screen, use the Browse button to set the connector configuration file to TestConnectorBus.cfg, and set the business object schema directory to the location where the customer.xsd has been placed. Click Next.
  4. At the Find and Discover Enterprise Services screen, press the Run Query button.
  5. Select the object that was returned by the query: Customer and click Add.
  6. For Customer, select the check boxes next to sendCustomerRequest, click OK, and then Next.
  7. Enter wbia/asbo for the Folder. Click Finish.
  8. Double-click Customer under the Customer module in the Business Integration view to open the assembly editor. This contains a JMS Import representing the TestConnector as shown in Figure 2.
Figure 2. Assembly Editor
Assembly Editor

Creating an interface

Create a sample interface, CustomerInfo, that will be implemented by the POJO:

  1. In the Business Integration view, right-click Interfaces and select New => Interface.
  2. Enter the name of the interface as CustomerInfo.
  3. Add a Request-Response operation to the interface by the name getCustomerInfo.
  4. Add an input variable to the operation by the name customerID of type string.
  5. Add an output variable to the operation by the name customerName of type string.

Creating a simple Java component

  1. Double-click on Customer under the Customer module to open the Assembly Editor. Drag and drop the CustomerInfo interface on to the Assembly Editor. Select Component with No Implementation Type.
  2. Change the name of Component1 to CustomerRequest.
  3. Right-click on CustomerRequest and select Add => Reference and type OutboundRequest in the Filter by Interface field. Select OutboundRequest, set the name as OutboundRequestPartner and click on OK.
  4. Draw a wire between the CustomerRequest component and the JMS Import for the TestConnector.
  5. Right-click on CustomerRequest and select Generate Implementation => Java. Select the default package and click OK.
  6. Insert the following lines of code for the implementation of the method getCustomerInfo:
    Listing 1. Sample code
    ServiceManager serviceManager = new ServiceManager();	
    		
    BOFactory dataFactory = 
    (BOFactory) serviceManager.locateService("com/ibm/websphere/bo/BOFactory");
    		
    DataObject custBG = 
    dataFactory.create(
    "http://www.ibm.com/websphere/crossworlds/2002/BOSchema/Customer/CustomerBG",
    "CustomerBG");
    
    DataObject custObj = 
    dataFactory.create(
    "http://www.ibm.com/websphere/crossworlds/2002/BOSchema/Customer",
    "Customer");
    
    custObj.setString("Id",customerID);
    custBG.setDataObject ("Customer",custObj);
    custBG.setString("verb","Create");
    
    OutboundRequest custService = 
    (OutboundRequest) serviceManager.locateService("OutboundRequestPartner");
    
    DataObject custResponse = custService.sendCustomerRequest(custBG);		
    String customerName = custResponse.getDataObject("Customer").getString("Name");		
    return customerName;
  7. Right-click and select Source => Organize Imports to add the relevant imports for the API.
  8. The Assembly Editor appears as shown in Figure 3.
    Figure 3. Assembly Editor
    Assembly Editor

Installing and deploying the solution

Now you will add the module to the test server:

  1. In the Servers view, check if the test server is started. Else, right-click the test server and select Start.
  2. Once the server is started, select Add and Remove Projects.
  3. In the Add and Remove Projects window, select CustomerApp from the Available projects list.
  4. Click Add to add the project to the server.
    Figure 4. Add Project to Server
    Add Project
  5. Click Finish. The project will be installed and published to the test server.
  6. Wait for the application to start successfully.

Verifying creation of JMS resources

The JMS resources required to be defined for the various queues used by the adapter are automatically configured when the SCA module was added to the test server in the previous step.

JMS queues

Right-click on the server and select Run administrative console to launch the WebSphere Administrative console. Navigate to Resources => Default messaging => JMS queue.You will find the queues defined as shown in Figure 5.

Figure 5. JMS resources
JMS resources

Service Integration Bus destinations

Each of the JMS queue resources defined above are associated to a destination in the Service Integration Bus. To view the destinations defined on the bus, from the administrative console, navigate to Service Integration => Buses => SCA.APPLICATION.widCell.Bus => Destinations. You will find the destinations defined as shown in Figure 6.

Figure 6. Service Integration Bus destinations
Service Integration Bus destinations

Testing the scenario

WebSphere Integration Developer comes with a testing client tha you can launch from the Assembly Editor. You can test any of the SCA components individually using this integrated test client.

  1. From the assembly editor, right-click on the CustomerRequest component and select Test Component.
  2. This launches the Test Client interface. In the configurations tab, check if there is an Emulator for the Customer Module. You can use the emulator to emulate the TestConnector implementation for testing purposes as the adapter in our sample is not connected to any real time enterprise system.
    Figure 7. Emulator
    Emulator
  3. Go back to the events tab and enter the customerID as 101 and click on Continue.
  4. Select the Deployment Location as WebSphere Process Server v6.0.
  5. In the next screen, fill in the output parameters as follows, or any other value of your choice:
    Figure 8. Output values
    Output values
  6. Click on Continue.
  7. The final output returned shows the value of variable customerName as "John".
    Figure 9. Test result
    Test result

Conclusion

This article showed how WebSphere Business Integration Adapters work with WebSphere Process Server as the integration broker. The synchronous request-response message interaction pattern demonstrated the interaction. The article demonstrated the use of the SCA API to invoke the method on the adapter from a normal Java component and read the response received from it. It also glanced through the various JMS resources and Service Integration Bus destinations that are automatically created in WebSphere Application Server, once the module is added to WebSphere Process Server from WebSphere Integration Developer.


Download

DescriptionNameSize
Sample adapterwbia-sample.zip4 KB

Resources

Learn

Get products and technologies

Comments

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 WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=109629
ArticleTitle=Integrate WebSphere Business Integration Adapters with WebSphere Process Server V6: Synchronous Request Response (OutboundRequest) scenario -- Part 2
publish-date=04262006