Chapter 2. Financial services business scenario 293
Figure 2-297 Create a facade session bean in A2ZEJB_BrokerageSCAAPI project 7/11
294 SOA Solutions Using IBM Information Server
Figure 2-298 Create a facade session bean in A2ZEJB_BrokerageSCAAPI project 8/11
Figure 2-299 Create a facade session bean in A2ZEJB_BrokerageSCAAPI project 9/11
Chapter 2. Financial services business scenario 295
Figure 2-300 Create a facade session bean in A2ZEJB_BrokerageSCAAPI project 10/11
Figure 2-301 Create a facade session bean in A2ZEJB_BrokerageSCAAPI project 11/11
296 SOA Solutions Using IBM Information Server
Example 2-10 BrokerageFacadeBean.java
package a2z;
import java.util.Date;
import com.ibm.websphere.sca.Service;
import com.ibm.websphere.sca.ServiceManager;
import com.ibm.websphere.sca.Ticket;
import com.ibm.websphere.sca.sdo.DataFactory;
import commonj.sdo.DataObject;
/**
* Bean implementation class for Enterprise Bean: BrokerageFacade
*/
public class BrokerageFacadeBean implements javax.ejb.SessionBean {
private javax.ejb.SessionContext mySessionCtx;
/**
* getSessionContext
*/
public javax.ejb.SessionContext getSessionContext() {
return mySessionCtx;
}
/**
* setSessionContext
*/
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
}
/**
* ejbCreate
*/
public void ejbCreate() throws javax.ejb.CreateException {
}
/**
* ejbActivate
*/
public void ejbActivate() {
}
/**
* ejbPassivate
*/
public void ejbPassivate() {
}
/**
* ejbRemove
*/
public void ejbRemove() {
}
public int placeTrade(String ssnumb, String stock, int quantity,
String accountNumber, String typeOfOrder) {
// create input BO
DataObject tradesInput = DataFactory.INSTANCE.create("http://A2ZSCA_Brokerage", "PlaceTradeInput");
Chapter 2. Financial services business scenario 297
tradesInput.setString("ssnumb", ssnumb);
tradesInput.setString("stock", stock);
tradesInput.setInt("quantity", quantity);
tradesInput.setString("accountNumber", accountNumber);
tradesInput.setString("typeOfOrder", typeOfOrder);
// lookup standalone reference
ServiceManager serviceManager = ServiceManager.INSTANCE;
Service tradesService = (Service) serviceManager.locateService("TradesInterfacePartner");
DataObject operationResult = (DataObject) tradesService.invoke("placeTrade", tradesInput);
// get value from result BO
DataObject tradesOutput = operationResult.getDataObject("output");
int result = tradesOutput.getInt("orderNumber");
return result;
}
}
Associate the EJB project with the WID module
The EJB project A2ZEJB_BrokerageSCAAPI must be associated with the
A2ZSCA_Brokerage WID module using WebSphere Integration Developer as
shown in Figure 2-302 through Figure 2-304 on page 298.
Figure 2-302 Associate EJB project with the WID module 1/3

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.