Java Development News:
Integrating CICS with the Jbi4CICS Component
By Amedeo Cannone and Stefano Rossini
01 Jul 2007 | TheServerSide.com
Thanks to the wide adoption of Service Oriented Architecture, the JBI specification is becoming more and more popular. With JBI, development of new integration components that can be installed in compliant Enterprise Service Bus (ESB) is possible, to act as bridges between the BUS and the old communication technologies.
Gruppo Imola is a contributor of the open-jbi-components project and a Netbeans strategic partner and has developed so far two Open Source JBI Binding Components: Jbi4Corba and Jbi4Cics.
The Jbi4Cics component is an Open Source JBI Binding Component that can be used to connect an ESB with a CICS system. The Jbi4Cics component is developed and tested on the OpenESB platform and it is integrated with Netbeans Enterprise.
In this article we present the Jbi4Cics component along with an integration use-case sample developed using the new Sun Microsystems Netbeans Enterprise.
Integration, ESB and JBI
Every complex system evolves through the years using different technologies, standards and architectures: this involves integration costs. Java Business Integration (JBI) seeks to address this problem by creating a standards-based architecture for integration solutions.
Every integration problem is unique; an appropriate combination of JBI-compliant components will provide a solution that is sized appropriately to the problem at hand.
A JBI-compliant ESB allows integration, in a standard way, from the Legacy technologies to new technology; the JBI components are the bridge between the “external” world and the service bus.
For instance, with Jbi4Corba you can expose a CORBA servant inside the bus, or expose an internal service as a corba servant: the component is responsible for the communication (transforming the CORBA request in XML messages) and for publishing of service on the BUS (as a standard WSDL definition).
With Jbi4Cics you can expose a CICS service inside the bus: the component is responsible for the communication (transforming the ECI request in XML messages) and for publishing of service on the bus (as a standard WSDL definition).
The JBI specifications define two different kinds of components suitable to be deployed in a ESB: Binding Components (BC) and Service Engines (SE).
While Service Engines are useful to contain pure integration logic, the binding components are the “connection” between the BUS and the external applications.
Of course, while inside the bus a “lingua franca” is used (basically, soap messages), outside the BUS a plethora of different communication technologies are present. For this reason, the JBI specification provides the concept of the Binding Component.
When a message is received by an external service, the BC’s job is to normalize and send it to the receiver endpoint (that can be both a SE or another BC) using the “Normalized Message Router” (NMR).
When the message has to be returned to external service, it must be translated from the NMR format to the external format; thus, the NMR routes messages between services and bindings.
According to JBI, integration solutions must be deployed in Service Assemblies (SA), composed using BC and SE correctly configured to create a coherent message flow inside the bus. An application developed using these concepts is called a “Composite Application”.
The JBI4Cics Component
Gruppo Imola has developed the Jbi4Cics Open Source Binding Component.
With this component is possible to seamlessly integrate CICS systems with any other application, because it allows you to map a CICS ECI service as an internal JBI endpoint. Having an internal JBI endpoint opens a wide spectrum of possibilities because the endpoint can participate to the message streams and the orchestrations that take place inside the ESB.
We have developed a plugin for Netbeans [https://open-jbi-components.dev.java.net/servlets/ProjectDocumentList?folderID=7040&expandFolder=7040&folderID=7039] that allows full integration of the component with OpenESB (The Open Source ESB developed by Sun Microsystems).
Let's take a look inside the component to understand its main features [http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=CICSBC] and how it works.
The main characteristics of the Jbi4Cics component (Current release 0.2) are:
- Released under the LGPL License v2.1
- Support for OpenESB and ServiceMix
- Netbeans plug-in compliant with Netbeans enterprise suite.
- Support for CICS-ECI synchronous calls (i.e. InOut MEP).
- Support for String, Binary, Packed Decimal, Zoned Decimal COBOL data types.
- Support for nested structures and fixed length occurs.
Basically, the CICS component acts as a provider (from the perspective of the bus is a component that can be used from other components to invoke a service) exposing a CICS ECI Service on the BUS.
As you see there are 4 elements:
- the ESB
- an invoker endpoint
- the Jbi4Cics BC
- the CICS Transaction Gateway (CTG)
In this configuration, the invoker endpoint can send a normalized message to the BC that will be transformed in a CTG request. The BC knows the specific CTG and the COBOL program so it can call the CICS service. The result of the call is normalized and delivered to the invoker.
During this “exchange” the BC uses three pieces of information defined when the provider was configured: the host and the port where the CTG is located (via a JCA Connection Factory), the COBOL program name and the CICS Server name.
At this point, according with the “configure, don't code” philosophy, to use Jbi4Cics no programming language knowledge is required, but only configuration data must be managed.
So the only task for the user is to configure how the BC can locate the CTG (via JCA Connection Factory) and specify the COMMAREA file that represents the interface exposed by the COBOL service.
To show how Jbi4Cics component can be used, we can imagine a simple integration scenario.
In this example we have to integrate an easy COBOL program (that exposes a string length service) inside a BPEL process. [Editor’s note: of course, calculating a string’s length is a notable weak spot for COBOL, so this example is contrived beyond belief, but let’s run with it anyway.]
The COBOL program interface is defined using a simple text file, where we declare its commarea (the region of data used to communicate with systems external to the COBOL program.) This method accepts an input and returns its length.
02 inputString PIC X(30) DISPLAY.
02 strlen PIC 9(10) DISPLAY.
The sample COMMAREA used in the example
We need some Open Source tools:
- Netbeans IDE 5.5.1 [link: http://www.netbeans.org/]
- Netbeans Enterprise Pack 5.5.1 [link: http://www.netbeans.org/]
- Jbi4Cics Netbeans plugin [link: https://open-jbi-components.dev.java.net/servlets/ProjectDocumentList?folderID=7039&expandFolder=7039&folderID=7040]
- Jbi4Cics Binding Component [link: https://open-jbi-components.dev.java.net/servlets/ProjectDocumentList?folderID=7039&expandFolder=7039&folderID=7040]
First of all, install the Netbeans IDE and the Enterprise Pack. Then, download and unzip the Jbi4Cics Netbeans plugin in a temporary directory (some .nbm files should be unpacked).
Start the Netbeans IDE and then select:
- Tools -> Update Center -> Install Manually Downloaded Modules (.nbm files) -> next
- Selects the unpacked nbm files -> next -> next
- Accept the License Agreement
- Select to Include all the modules, and then finish.
Install the jbi4cics component
First of all, start the Sun Java System Application Server, following these steps:
Open the runtime view.
Right-click on the server and start it.
Install the jbi4cics component
Open the “JBI” server subfolder, right-click on “Binding Components” and select “Install New Binding Component”
Select the jbi4cics installer previously downloaded (jbi4cics-0.2-installer.zip).
Now the jbi4cics component appears. Right-click on it and select “Start”.
Creating the Service WSDL
The next step is to create a new WSDL from the COBOL program interface. With this WSDL, you can add the CICS service as a partner-link in a BPEL process. This operation is the main task performed by the Jbi4Cics Netbeans plugin (it recognizes the file extensions CPY and cpy for the Copy Cobol file).
From the Netbeans IDE, select:
New Project -> Service Oriented Architecture -> BpelModule
Netbeans will create a folder, where you can add the CPY file.
Then right-click the CPY file and select “Create WSDL”.
The jbi4cics wizard now should appear asking you about some configuration data that must be specified.
Design the BPEL process with Netbeans
Now you can design a process using the new Netbeans BPEL editor. The first thing is to define the WSDL for the whole process. Next, according with BPEL, a partner link must be created for each service involved.
In JBI4Corba we talked about a simple BPEL process; the process designed was very simple: a message is received and then is used to call the CORBA servant. The CORBA service interface is defined using an IDL file, where we declare a “getBalance()” method. This method accepts an input string (that represents the name of a user), and returns a double number (between 0.00 and 100.00).
Now we're going to add a little bit of complexity to the process.
We want to know the Account balance only if the Account is valid. We're going to invoke a COBOL program that accepts an input string (that represents the name of a user), and returns a integer number (between 0 and 5) where 0 means an invalid Account status while a number greater than 0 means a valid Account.
The BPEL process should returns the balance only for valid user and should return 0 for the case where the user is invalid.
The process that we’re going to design is as follows: a message is received and then is used first to call the CORBA servant and then the COBOL program.
We have got two partnerLinks, one is a CORBA Servant to be integrated via Jbi4Corba, the other one is a COBOL program to be integrated via Jbi4Cics. Notice that with Netbeans you can design all the process visually, without any knowledge of programming languages.
Creating a new Composite application, including the BPEL module
When the BPEL project is ready, you have to create the Composite Application (CA)project.
The CA will include a SOAP binding component (automatically added by Netbeans), the BPEL process and the CICS binding component.
After the project creation, follow these steps:
Right-click the CA project node and choose “Add JBI module” (selecting the BPEL module previously created)
Right-click the CA project node and choose “Build Project”
Right-click the CA project node and choose “Edit Project”
Now, you should see the Composite Application Service Assembly (CASA) editor.
Deploy the Composite Application
Now you are ready to deploy! To deploy, simply right-click on the Composite Application project and select “Deploy Project”. To see the deployed SA on the server, right-click “Service Assemblies” subfolder and select “refresh”
Then you can use the Netbeans Test feature to test directly the Composite Application with SOAP messages.
The Jbi4Cics component is currently released in version 0.2, but the development continues.
Gruppo Imola and SUN Microsystem have defined the following roadmap for next releases:
Release 0.5 (III Qt 2007):
- More COBOL data types (floating point, log floating point, date …).
- Variable length OCCURS clauses
- Support for redefines clause
- Asynchronous calls (i.e. InOnly MEP).
Release 1.0 (I Qt 2008):
- More security features
- More transactional features
- More management features
The advent of SOA and Web Services is pushing companies into reorganizing their software portfolios as a set of reusable services. In this reorganization, the legacy software is normally “wrapped” to save the company assets, and exposed as service using an ESB. In the business areas where this assets are mainly Host systems, the Jbi4Cics component can be helpful in this scenarios. In fact, with Jbi4Cics component, it's possible to allow the Legacy Cics integration in an ESB environment.
M.Piraccini, M. Casoni: Jbi4Corba - Mokabyte N. 117
S. Rossini: Java Business Integration - Mokabyte N.100, 101 e 102