150 Managing Information Access to an EIS Using J2EE and Services Oriented Architecture
batch import and generation if your IMS transactions and COBOL copybooks
change frequently. Refer to the WebSphere Studio Application Developer
Integration Edition Help for more details (search for
batch import).
IMS transactions often return multi-segmented messages which means that they
return a byte stream with variable length and data structures. The WebSphere
Studio Application Developer Integration Edition tools cannot generate the WSIF
format handlers and helper classes for multi-segmented messages. A
workaround is to generate helper classes for the different segments by defining
an artificial operation that returns each segment. The segment data type can be
selected from the COBOL copybook for that transaction. Having created the
WSIF format handlers for the segments, development of code to parse the byte
stream returned by the IMS transaction is facilitated.
Creating the IMS access feature
As described in section “The stock trade scenario” on page 137, the IMS feature
consists of the utility classes and a session bean. The session bean implements
the feature interface.
We created the session bean using the J2EE tools of WebSphere Studio
Application Developer Integration Edition. To do this:
1. Go to the J2EE perspective, and select the EJB project in the J2EE Hierarchy
view.
2. Open the EJB generation wizard by selecting New
→ Enterprise Bean.
In the wizard, you select the bean type (for example, session bean) and
provide names for the bean and the Java package. For the feature bean, you
also have to generate a local interface, so make sure to check Local client
view.
Furthermore, you can select the interface that the session bean extends for both
the local and remote view. In this case, you have to create the feature Java
interface as depicted in Figure 6-7 on page 140. Alternatively, you can add the
methods to the bean implementation class and promote the methods to the local
and remote interface, respectively.
Example 6-2 on page 151 shows the code for the Trader IMS feature of the
interface operations. In the runTransaction() method, we used the J2C API to
access the IMS system. The INBUFFER and OUTBUFFER Java classes and the
corresponding WSIF format handlers are generated by the WebSphere Studio
Application Developer Integration Edition wizard.