It is relatively straightforward to run a CXF service in a Tomcat container on z/OS. This makes it possible to access data stored on these mainframes, for example in DB2 databases and to expose that data as a Web Service using the same methods used on other platforms. No mainframe specific knowledge or skills are required.
There are a couple of steps:
- Copy Tomcat to z/OS and set it up
- Deploy a service
- Test a service
Copy Tomcat to z/OS and set it up
Simply copying Tomcat to z/OS, extracting the jar and running the startup script does not work in the case of z/OS, since z/OS is an EBCDIC platform, instead of an ASCII platform that Tomcat pretty much assumes.
Tomcat needs to be extracted correctly and instead of running it using the startup script, it needs to be executed under the control of JZOS. JZOS is supplied as part of the IBM JDK on z/OS. If your version of the JDK on z/OS does not include JZOS, you need to obtain a newer version of the JDK that does include it.
Tomcat then needs to be configured and started by following the instructions for JZOS and Tomcat
Sample JCL to run Tomcat looks as follows:
# This is a shell script which configures
# any environment variables for the Java JVM.
# Variables must be exported to be seen by the launcher.
# Set JZOS specific options
# Use this variable to specify encoding for DD STDOUT and STDERR
# Use this variable to prevent JZOS from handling MVS operator commands
# Use this variable to supply additional arguments to main
# Configure JVM options
# Note that Tomcat requires default ASCII file.encoding
# Configure SDK5.0 to use shared classes (at group level)
# You must comment this out if you are not running SDK 5
export IBM_JAVA_OPTIONS="$IJO "
This JCL needs to be updated with your JDK and Tomcat installation locations.
Deploy a service
Services can be deployed as usual for Tomcat. For example, the service WAR file can be FTP-ed to the .../webapps HFS directory or the Tomcat Manager can be used to deploy the service. If using FTP or another copy procedure to copy WAR file to z/OS, ensure that the WAR file is copied in binary mode, otherwise it will be ASCII-EBCDIC translated during the FTP and completely corrupted.
Test a service
Just point your SOAP client at the hostname, port and CXF service details of the Tomcat server running on z/OS and the client should run fine. You should not see any difference from running it against a non-mainframe host.