There are many ways to call a Java™ application that
is running in a JVM server. The method used will depend upon the characteristics of the JVM
server.
About this task
You can invoke a web application running in a Liberty
JVM server by using a HTTP request with a specific URL. Web applications
cannot be driven directly from EXEC CICS LINK or EXEC CICS START.
To invoke a Java application
that is running in an OSGi JVM server, you can either EXEC CICS LINK
to a PROGRAM defined Java, or
EXEC CICS START a TRANSACTION that has a target PROGRAM defined as
Java. The PROGRAM definition specifies a JVMSERVER, and the name of
a CICS® generated OSGi service
you wish to invoke. Such 'linkable' OSGi services are created by CICS when you install an OSGi bundle
that includes a CICS-MainClass header in its manifest. The CICS-MainClass
header identifies the main method of the Java class in the OSGi bundle
that you wish to act as an entry-point to the application.
An
OSGi service is a well-defined interface that is registered in the
OSGi framework. OSGi bundles and remote applications use the OSGi
service to call application code that is packaged in an OSGi bundle.
An OSGi bundle can export more than one OSGi service. For more information
see updating_osgi.html.
Note: In
a Liberty JVM server, you can also create OSGi services within an
Enterprise Bundle Archive (EBA), or within the OSGi application project
that defines an EBA (Web application). However these OSGi services
cannot be the target of a CICS PROGRAM definition, nor are they visible
to components packaged outside of that same EBA.
Invoking Java function in a classpath based
JVM server is usually performed as part of a specific capability of
a JVM server, such as BATCH, Axis2 and SAML. For these capabilities
the DFHSJJI vendor interface is provided.
Procedure
- For a web application developed as a WAR file or as an
EBA file containing WAB files and running in a Liberty JVM server,
invoke the application from the client browser by using a URL.
- For OSGi bundles that are deployed in an OSGi JVM server,
follow these steps:
- Determine the symbolic name of the active OSGi service
that you want to use in the OSGi framework.
Click in CICS Explorer® to
list the OSGi services that are active.
- Create a PROGRAM resource
to represent the OSGi service to other CICS applications:
- In the JVM attribute, specify YES to indicate
that the program is a Java program.
- In the JVMCLASS attribute, specify the symbolic name of the OSGi
service. This value is case sensitive.
- In the JVMSERVER attribute, specify the name of the JVMSERVER
resource in which the OSGi service is running.
- You can call the Java application
in either of two ways:
- Use a 3270 or EXEC CICS START request that
specifies a transaction identifier. Create a TRANSACTION resource
that defines the PROGRAM resource for the OSGi service.
- Use an EXEC CICS LINK request, an ECI call,
or an EXCI call. Name the PROGRAM resource for the OSGi service when
coding the request.
-
For Axis, Batch or SAML function see Configuring a JVM server for Axis2, Modern Batch overview, and Configuring CICS for SAML.
Results
You have created the definition to make your Java application available to other components.
When CICS receives the request
in the target JVM server it invokes the specified Java class or Web application on a new CICS Java thread.
If the associated OSGi service or Web application is not registered
or is inactive, an error is returned to the calling program.