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
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:
- 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.
- 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.
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.
- Download the files required for the adapter configuration from the provided wbia-sample.zip file.
customer.xsdfiles to a local directory.
- Open the
TestConnectorBus.cfgfiles 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.xsdfile in your file system.
Launching Integration Developer with a new Workspace
- From the start menu, select Start => Programs => IBM WebSphere => Integration Developer V6.0 => WebSphere Integration Developer V6.0.
- Select a suitable workspace location.
- When WebSphere Integration Developer v6.0 opens, close the Welcome page.
Creating a new module
- Select File => New => Other.
- Select Module and click Next.
Customerfor 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.
- Right-click on the Customer folder and select New => Enterprise Service Discovery.
- Select WBI Adapter Artifact Importer and click on Next.
- 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.xsdhas been placed. Click Next.
- At the Find and Discover Enterprise Services screen, press the Run Query button.
- Select the object that was returned by the query: Customer and click Add.
- For Customer, select the check boxes next to
sendCustomerRequest, click OK, and then Next.
wbia/asbofor the Folder. Click Finish.
- 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
Creating an interface
Create a sample interface, CustomerInfo, that will be implemented by the POJO:
- In the Business Integration view, right-click Interfaces and select New => Interface.
- Enter the name of the interface as
- Add a Request-Response operation to the interface by the name getCustomerInfo.
- Add an input variable to the operation by the name customerID of type string.
- Add an output variable to the operation by the name customerName of type string.
Creating a simple Java component
- 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.
- Change the name of Component1 to CustomerRequest.
- Right-click on CustomerRequest and select Add => Reference and type
OutboundRequestin the Filter by Interface field. Select OutboundRequest, set the name as OutboundRequestPartner and click on OK.
- Draw a wire between the CustomerRequest component and the JMS Import for the TestConnector.
- Right-click on CustomerRequest and select Generate Implementation => Java. Select the default package and click OK.
- Insert the following lines of code for the implementation of the method
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;
- Right-click and select Source => Organize Imports to add the relevant imports for the API.
- The Assembly Editor appears as shown in Figure 3.
Figure 3. Assembly Editor
Installing and deploying the solution
Now you will add the module to the test server:
- In the Servers view, check if the test server is started. Else, right-click the test server and select Start.
- Once the server is started, select Add and Remove Projects.
- In the Add and Remove Projects window, select CustomerApp from the Available projects list.
- Click Add to add the project to the server.
Figure 4. Add Project to Server
- Click Finish. The project will be installed and published to the test server.
- 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.
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
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
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.
- From the assembly editor, right-click on the CustomerRequest component and select Test Component.
- 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
- Go back to the events tab and enter the customerID as
101and click on Continue.
- Select the Deployment Location as WebSphere Process Server v6.0.
- In the next screen, fill in the output parameters as follows, or any other value of your choice:
Figure 8. Output values
- Click on Continue.
- The final output returned shows the value of variable customerName as "John".
Figure 9. Test result
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.
|Sample adapter||wbia-sample.zip||4 KB|
- WebSphere Application Server Network Deployment Information Center
- IBM WebSphere Business Process Management V6.0 Information Center
- WebSphere Business Integration Adapters
- developerWorks WebSphere Business Integration zone
- WebSphere Education
- WebSphere Technical Podcast series
- developerWorks WebSphere Process Server and WebSphere Integration Developer resource page
Get products and technologies
- Download a free trial version of WebSphere Application Server Version 6.0.
- Build your next development project with IBM trial software, available for download directly from developerWorks.
Dig deeper into WebSphere on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Experiment with new directions in software development.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.