Chapter 2. Financial services business scenario 307
2.9 Step 5: Create “services” consumers
In this section, we describe how the IBM Information Server and WebSphere
Integration Developer generated services (with a variety of bindings) are
consumed by client applications. Our client development environments were
chosen to demonstrate that IBM Information Server (and WID) generated
services integrate seamlessly into typical integrated development environments
such as:
򐂰 Rational Application Developer (RAD) to develop JSPs and portlets
򐂰 Microsoft Visual Studio® 2005 Professional Edition to develop ASPs using
.NET as a fat client and thin client
򐂰 WebSphere Integration Developer to develop a JSP that invokes a WID
generated service via an async API
Figure 2-316 on page 308 (Rational Application Developer), Figure 2-317 on
page 308 (Visual Studio .NET Professional Edition with only SOAP over HTTP
binding), and Figure 2-318 on page 308 (WebSphere Integration Developer with
only SCA binding) provide an overview of some of the business functions and
various “service consumer” examples implemented in the A2Z Financial
Services’ self service solution.
Also shown are certain business functions (such as Get Account balance) that
are implemented exclusively using WID generated services, or exclusively using
IBM Information Server generated services — the objective of this exercise was
to demonstrate the impact on application development of using one approach
over the other. Each of these examples is described in further detail in the
following sections.
Important: In all the examples, the focus is not on providing a tutorial on using
a particular development tool such as RAD, Visual Studio and WID, but on the
steps involved in invoking the IBM Information Server and WID generated
services defined earlier. Therefore, little explanation is provided on the screen
interaction of the particular development tool.
308 SOA Solutions Using IBM Information Server
Figure 2-316 Client types, business functions, and service types developed using RAD .
Figure 2-317 Client types, business functions, and service types developed using Visual Studio .NET
Figure 2-318 Client types, business functions, and service types developed using
WID ASYNC
A2Z Financials
Business Function
(nile.itsosj.sanjose.ibm.com)
Open brokerage account (JSP)
Perform a trade (JSP)
JMS
PlaceTradeProcess
WebSphere Integration Developer
(lead.itsosj.sanjose.ibm.com)
Services Binding
SCA
using
Façade Session Bean
GetBalancesProcess
Information Server Services
(radon.itsosj.sanjose.ibm.com)
Binding
Services
AuthorizationService
AccountStatusService
AuditService
AuthorizationService
placeTradesService
AuditService
EJB
EJB
EJB
EJB
SOAP over HTTP
EJB
Get Account balance for the brokerage
accounts (Portlet)
Perform a trade (portlet)
AuthorizationService
placeTradesService
AuditService
EJB
SOAP over HTTP
EJB
OpenAccountProcess
SOAP over HTTP
A2Z Financials
Business Function
(laptop with VS .NET)
Update Credit Card customer
(Thick client)
Get Credit Card transactions
(Thin client)
UpdateCustomer
WebSphere Integration Developer
(lead.itsosj.sanjose.ibm.com)
Services (SOAP over HTTP only)
Information Server Services
(radon.itsosj.sanjose.ibm.com)
Services (SOAP over HTTP only)
CustomerIDLookupService
AuthorizationService
StandardizeAddressService
CardMaintenanceService
AuditService
Update Credit Card customer
(Thin client)
UpdateCustomer
GetTransactions
A2Z Financials
Business Function
(lead.itsosj.sanjose.ibm.com)
Update Brokerage customer
WebSphere Integration Developer
(lead.itsosj.sanjose.ibm.com)
BindingServices
UpdateBrokerageProfileProcess Session Bean Façade to ASYNC SCA API
Chapter 2. Financial services business scenario 309
Example 2-11 SOAP over HTTP binding client code
import A2Z_Library.GetAllBalances;
import A2Z_Library.GetAllBalancesOut;
........
protected GetAllBalances lookupGetAllBalances()
........
protected GetAllBalances lookupGetAllBalances() {
try {
Service locator = (Service)
ServiceLocatorManager.getServiceLookup(STATIC_GetAllBalances_REF_NAME,STATIC_GetAllBalances_CLASS);
GetAllBalances aGetAllBalances = (GetAllBalances) locator.getPort(STATIC_GetAllBalances_CLASS);
return aGetAllBalances;
}
.........
GetAllBalances aGetAllBalances = lookupGetAllBalances();
try {
GetAllBalancesOut out = aGetAllBalances.getAllBalances(ssnumb);
Example 2-12 SOAP over HTTP binding .NET client code
Protected Sub invokeWIDServices()
Dim service As New A2ZFinancialServices.UpdateCustomer.UpdateCustomer_UpdateCustomerInfoProcessHttpService
Dim updateCustInfo As New A2ZFinancialServices.UpdateCustomer.updateCustomerInfo
Dim custInfo As New A2ZFinancialServices.UpdateCustomer.CustomerInfo
Dim response As A2ZFinancialServices.UpdateCustomer.updateCustomerInfoResponse
Example 2-13 JMS binding client code
import java.rmi.RemoteException;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
Attention: A snippet of how a service is invoked from a client application with
a particular binding is shown in Example 2-11 through Example 2-16 on
page 312. These show the import of the relevant classes, libraries, and
packages, as well as the lookup and invocation of the specific operation
associated with a given service. This is explained in more detail in the relevant
examples in the following sections.
310 SOA Solutions Using IBM Information Server
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import a2zselfserviceweb.forms.CustomerInfoForm;
import com.ibm.isd.CommonServicesApp.AuthorizationService.server.AuthorizationServiceHome;
import com.ibm.isd.CommonServicesApp.AuthorizationService.server.AuthorizationServiceRemote;
...................
static Context getContext() throws Exception
{
// create context for remote server where the JMS Queues are defined
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(Context.PROVIDER_URL, "iiop://lead:2809");
Context context = new InitialContext(props);
return context;
}
/**
* write the key-value pairs of the input as a JMS MapMessage
*/
public void writeOpenAccount(Map m) throws Exception
{
// lookup Queue
Context ctx = getContext();
Object o = ctx.lookup("jms/MQCFLead");
QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) o;
o = ctx.lookup("jms/Q1lead");
Queue queue = (Queue) o;
// use standard JMS API to create message
QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
QueueSession session = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);
MapMessage message = session.createMapMessage();
// use SSNumber as correlation ID
message.setJMSCorrelationID((String) m.get("ssnumb"));
// the "TargetFunctionName" property is used by the MQ JMS binding
// use the name as indicated in the "native method" field
// of the "Method binding" tab
message.setStringProperty("TargetFunctionName", "openAccount");
// prepare MapMessage
Iterator it = m.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Object value = entry.getValue();
message.setObject((String) entry.getKey(), value);
}
System.out.println("Write message: " + message);
sender.send(message);
queueConnection.close();
}
/**
* blocking read from the result queue
*/
public Map readOpenAccount() throws Exception
{
Map result = null;
Context ctx = getContext();
// lookup Queue
Object o = ctx.lookup("jms/MQCFLead");
QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) o;
o = ctx.lookup("jms/Q2lead");
Queue outQ = (Queue) o;

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.