206 SOA Solutions Using IBM Information Server
3. Configure JMS properties to associate the JMS binding input and output data
binding format properties of the OpenAccountJMS export to the
A2ZOpenAccountDataBinding class created in the previous step. This defines
how the message put into the request queue by a client application is passed
to the business process, and how the output parameters from the client
application is written to the message queue, and the outgoing Business
Object of the business process is written to the response message queue.
4. Deploy the module by creating an Enterprise archive (.ear) file for the
A2ZSCA_Brokerage module, installing it on the WAS, followed by starting the
deployed application.
Write “binding” code
To write this code, proceed as follows:
1. Right-click A2ZSCA_Brokerage in WID, and select New and Other as shown
in Figure 2-198 on page 207.
2. Select Class under Java and click Next as shown in Figure 2-199 on
page 208.
3. Provide the name of the Package (a2z),the name of the Java class
(A2ZOpenAccountDataBinding), and click Finish as shown in Figure 2-200
on page 209.
Example 2-8 on page 209 shows the A2ZOpenAccountDataBinding “binding”
code we developed:
򐂰 The “read (Message jmsMessage)” class builds a business object from the
client’s MapMessage
򐂰 The “write (Message jmsMessage)” class reads the attributes of the output
business object and puts it in a result MapMessage
Note: Therefore, the code in the A2ZOpenAccountDataBinding.read()
method is the counterpart of the testWrite() method of the test client on
page 251. Similarly, the readOpenAccount() method of the test client
"matches" the method A2ZOpenAccountDataBinding.write().
Chapter 2. Financial services business scenario 207
Figure 2-198 Write “binding” code 1/3
208 SOA Solutions Using IBM Information Server
Figure 2-199 Write “binding” code 2/3
Chapter 2. Financial services business scenario 209
Figure 2-200 Write “binding” code 3/3
Example 2-8 A2ZOpenAccountDataBinding.java
* Created on Mar 8, 2007
package a2z;
import java.util.Date;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import com.ibm.websphere.sca.jms.data.JMSDataBinding;
import com.ibm.websphere.sca.sdo.DataFactory;
import commonj.connector.runtime.DataBindingException;
import commonj.sdo.DataObject;
* @author a2z
210 SOA Solutions Using IBM Information Server
public class A2ZOpenAccountDataBinding implements JMSDataBinding {
private DataObject sdo = null;
private boolean businessException = false;
/* (non-Javadoc)
* @see com.ibm.websphere.sca.jms.data.JMSDataBinding#getMessageType()
public int getMessageType() {
return JMSDataBinding.MAP_MESSAGE;
/* (non-Javadoc)
* @see com.ibm.websphere.sca.jms.data.JMSDataBinding#read(javax.jms.Message)
public void read(Message jmsMessage) throws JMSException {
if (jmsMessage.propertyExists("IsBusinessException")) {
businessException = jmsMessage.getBooleanProperty("IsBusinessException");
// TODO Load fault data from message , set in jmsData and return
MapMessage mapMessage = (MapMessage) jmsMessage;
// construct the operation BO
sdo = DataFactory.INSTANCE.create("http://A2Z_Library/OpenAccount", "openAccount");
sdo.setString("accountType", mapMessage.getString("accountType"));
// construct the CustomerInfo BO from from the client's MapMessage
DataObject customerInfo = sdo.createDataObject("customerInfo");
customerInfo.setString("name", mapMessage.getString("name"));
customerInfo.setString("ssnumb", mapMessage.getString("ssnumb"));
// MapMessage does not support date, use java.util.Date.getTime() instead
customerInfo.setDate("dob", new Date(mapMessage.getLong("dob")) );
customerInfo.setString("telephone", mapMessage.getString("telephone"));
customerInfo.setString("street", mapMessage.getString("street"));
customerInfo.setString("city", mapMessage.getString("city"));
customerInfo.setString("state", mapMessage.getString("state"));
customerInfo.setString("zipcode", mapMessage.getString("zipcode"));
/* (non-Javadoc)
* @see com.ibm.websphere.sca.jms.data.JMSDataBinding#write(javax.jms.Message)
public void write(Message jmsMessage) throws JMSException {
// read attributes of output BO and put it into result MapMessage
MapMessage mapMessage = (MapMessage) jmsMessage;
mapMessage.setString("message", sdo.getString("message") );
mapMessage.setString("newCustomerID", sdo.getString("newCustomerID") );
mapMessage.setString("newAccountNumber", sdo.getString("newAccountNumber") );

Get SOA Solutions Using IBM Information Server now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.