Tutorial: EJB Service Interface

Provides step-by-step instructions that start with defining an Enterprise Java Bean (EJB) service interface using the Interface Mapping Toolkit (IMTK), take you through the process of deploying it to an enterprise server instance, and generating and running a client to access it.
Restriction: This topic applies only when the Enterprise Server feature is enabled.

Prerequisites

  • Review the Assumptions and Before you begin a tutorial sections in the Tutorials: Interface Mapping Toolkit topic to ensure that your Visual COBOL environment is set up properly.
  • The following prerequisite software must be installed and configured before proceeding:
    Java JDK
    Before you can successfully deploy a Java service, you must have the Java Development Kit (JDK), installed. See the Java JDK section of Supported Operating Systems and Third-party Software for complete information on supported Java JDK versions and the latest Java JDK version installed automatically with Visual COBOL.

    Edit your system environment variables as follows:

    • Set JAVA_HOME to your Java installation directory
    • Add %JAVA_HOME%\bin to your system PATH environment variable
    JBoss EAP
    Before you can successfully access a Java service, you must install a Java application server. This tutorial provides instructions for using the RedHat JBoss EAP application server. For information about supported versions, see the Application Server JCA support for Enterprise Server topic under Additional Software Requirements.

    Following installation, continue with configuration:

    • Ensure that the JBOSS_HOME system environment variable is set to your JBoss installation directory.
    • Using any text editor, edit the standalone.xml file, located in your JBoss installation's standalone\configuration directory, as follows:
      Disable the jca subsystem
      Edit the <archive-validation> child of the <subsystem xmlns="urn:jboss:domain:jca:5.0"> element to read as follows:
      <archive-validation enabled="false" fail-on-error="true" fail-on-warn="false"/>
      Add the mfcobol-notx.rar resource adapter
      Replace the existing resource-adapters subsystem element in its entirety with the following subsystem definition:
      <subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
      	<resource-adapters>
      		<resource-adapter>
      			<archive>mfcobol-notx.rar</archive>
      			<transaction-support>NoTransaction</transaction-support>
      			<connection-definitions>
      				<connection-definition class-name="com.microfocus.cobol.connector.spi.CobolNoTxManagedConnectionFactory" jndi-name="java:/eis/MFCobol_v1.5" pool-name="CobolConnectionFactory">
      					<pool>
      						<min-pool-size>2</min-pool-size>
      						<max-pool-size>10</max-pool-size>
      					</pool>
      					<security>
      						<application/>
      					</security>
      				</connection-definition>
      			</connection-definitions>
      		</resource-adapter>
      	</resource-adapters>
      </subsystem>

Demonstration application - BookDemo

The BookDemo demonstration application represents a legacy COBOL application, meaning that this application is understood to have been in production use for some time. The application source code and project files are installed with Visual COBOL in the %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\Interface Mapping Toolkit\ServiceInterfaces\BookDemo$COBDIR/demo directory by default.

The BookDemo application is an online data application that uses an indexed file to maintain stock and inventory data such as might be in use at a book retailer. The application enables you to read, add, and delete records, and to progress from the current record to the next record. It uses the following source and data members:

book.cbl
Performs the four main functions of the application by receiving a user-supplied value via a linkage section, accessing or modifying the data based on the request received, and sending output data back to the user.
book-rec.cpy
Called by book.cbl, book-rec.cpy contains linkage section data structures.
bookfile.dat
The data file maintained by the book.cbl program.
bookfile.idx
The data index file.

Sequence

To complete this tutorial, progress through these topics in the order presented here. The bottom of each topic provides Next topic and Previous topic navigational links to help you proceed in the proper sequence: