This getting started guide shows how to install Jbi4Cics and a sample service assembly in ServiceMix . This component has been tested with servicemix-3.1-incubating.
Installing CICS JCA Resource Adapter
Jbi4Cics calls CICS ECI services via IBM's CTG Transaction Gateway. CTG Transaction Gateway may be called with JCA connector as shown in the following figure:
First thing to do is to install the connector. If you have a CICS Transaction Gateway you should also have a file named cicseci.rar. This file is a deployable resource adapter see CICS Transaction Gateway Home Page and J2EE Connector Architecture Home Page for more information on this topic.
ServiceMix supports JCA resource adapter through spring, to deploy the cicseci.rar simply unzip it and copy all contained jar in SERVICEMIX_HOME /lib/optional directory.
If you're using an application server deploy the cicseci.rar in it. Follow your application server documentation on how to do that, many servers have an administration console for this purpose.
Next step is to configure a connection to your CICS Transaction Gateway and make it visible to the Jbi4Cics Binding Component through JNDI.
Add the following code snippet to <SERVICEMIX_HOME>/conf/jndi.xml:
<bean id="eciManagedConnectionFactory" class="com.ibm.connector2.cics.ECIManagedConnectionFactory"> <property name="serverName"><value><CICS_NAME></value></property> <property name="connectionURL"><value><CTG_SERVER_NAME></value></property> <property name="portNumber"><value><CTG_SERVER_PORT></value></property> </bean> <bean id="eciConnectionFactory" class="org.springframework.jca.support.LocalConnectionFactoryBean"> <property name="managedConnectionFactory"> <ref local="eciManagedConnectionFactory"/> </property> </bean>
where:
then in the same file add a new entry in the JNDI entry map (bean id=jndi) as follow:
<!-- CICS connection --> <entry key="<JNDI_CICS_NAME>" value-ref="eciManagedConnectionFactory" />
where:
Follow the documentation on how to do that, many servers have an administration console for this purpose.
Of course in both cases you may define as many connections as needed.
Download Jbi4Cics and copy it into <SERVICEMIX_HOME>/install.
A service assembly is a deployable item that configure one or more endpoint inside a JBI ESB. We are going set up a configuration that take a CICS ECI service and expose it a SOAP/HTTP Webservice. The configuration is shown in the following figure:
The Jbi4Cics component is used to create an internal (i.e. visible inside the ESB) endpoint. This internal endpoint is then used to create an external endpoint with the servicemix-http Binding Component. The http component will proxy the incoming externall calls to the internal endpoint exploiting the JBI routing mechanisms.
A service assembly is a zip file containing one or more service unit file, each service unit defines one or more endpoint. We need two endpoints so we're going to configure two service units:
Both service units are a zip file.
A Jbi4Cics service unit has the following layout:
+- xbean.xml +- <COPY_COBOL> +- META-INF/ +- jbi.xml
where:
xbean.xml is a standard xbean file like those used by the Spring framework . It has the following content:
<?xml version="1.0"?> <beans> <bean class="it.imolinfo.jbi4cics.jbi.Jbi4cicsEndpoint"> <property name="copyCobolFileName" value="<COPY_COBOL>"/> <property name="codePage" value="<CODE_PAGE>"/> <property name="serviceDescriptor"> <bean class="it.imolinfo.jbi4cics.webservices.descriptor.ServiceDescriptor"> <property name="serviceName" value="<SERVICE_NAME>" /> <property name="serviceInterfacePackageName" value="<SERVICE_PACKAGE_NAME>"/> <property name="account"> <bean class="it.imolinfo.jbi4cics.security.J2CAccount"> <property name="username" value="<USERNAME>"/> <property name="password" value="<PASSWORD>"/> </bean> </property> <property name="serviceLocation"> <bean class="it.imolinfo.jbi4cics.locator.SimpleLocation"> <property name="connectionTypeName" value="CICS"/> <property name="locationName" value="<JNDI_CONNECTION_NAME>"/> </bean> </property> <property name="interactionDescription"> <bean class="it.imolinfo.jbi4cics.connection.jca.cics.CICSInteractionDescription"> <property name="programName" value="<PROGRAM_NAME>"/> <property name="transactionName" value="<TRANSACTION_NAME>"/> <property name="tpn" value="true"/> </bean> </property> </bean> </property> </bean> </beans>
where:
jbi.xml has the following content:
<?xml version="1.0" encoding="UTF-8"?> <jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0"> <services/> </jbi>
There is no parameter to specify.
Zip all the files in the specified layout and name the archive JBI4CicsSU.zip.
A http service unit has the following layout:
+- xbean.xml +- META-INF/ +- jbi.xml
where:
the xbean.xml has the following format:
<?xml version="1.0"?> <beans xmlns:http="http://servicemix.apache.org/http/1.0" xmlns:pkg="http://<REVERSED_PACKAGE_NAME>"> <http:endpoint service="pkg:<SERVICE_NAME>" endpoint="<SERVICE_NAME>JBIPort" role="consumer" locationURI="http://localhost:8192/Service/<SERVICE_NAME>" defaultMep="http://www.w3.org/2004/08/wsdl/in-out" soap="true" /> </beans>
where:
The jbi.xml is the same as the Jbi4Cics one.
Zip all the files in the specified layout and name the archive HttpSU.zip.
The service assembly is unit of deployable configuration in JBI, in our sample it has the following layout:
+- JBI4CicsSU.zip +- HttpSU.zip +- META-INF/ +- jbi.xml
where:
The jbi.xml has the following format as described in the JBI Specification :
<?xml version="1.0" encoding="UTF-8"?> <jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0"> <service-assembly> <identification> <name><SA_NAME></name> <description><SA_DESCRIPTION></description> </identification> <service-unit> <identification> <name>JBI4CicsSU</name> <description><SU1_DESCRIPTION></description> </identification> <target> <artifacts-zip>JBI4CicsSU.zip</artifacts-zip> <component-name>jbi4cics</component-name> </target> </service-unit> <service-unit> <identification> <name>HttpSU</name> <description><SU2_DESCRIPTION></description> </identification> <target> <artifacts-zip>HttpSU.zip</artifacts-zip> <component-name>servicemix-http</component-name> </target> </service-unit> </service-assembly> </jbi>
where:
Notice that the BC filenames (JBI4CicsSU.zip and HttpSU.zip) are specified with the respective component (jbi4cics and servicemix-http). Zip all the files in the specified layout and name the archive HttpToCicsSA.zip (the archive name is not important).
ServiceMix provides a maven2 plugin to automate the process of creation and deploy of JBI artifacts.
Copy the created service assembly in <SERVICEMIX_HOME>/deploy.