Deploy CADP for Java Webservices
CADP for Java WebService is built to run on an existing Apache Tomcat installation. This section includes the basic installation procedures and some troubleshooting tips to get the web server running. These instructions should not be used to create a secure, professional, efficient or production-ready web server. These instructions are here to give you a quick way to test CADP for Java WebServices.
The deployment provided in this section is tested on Apache Tomcat 9.0.4.
Prerequisites
Any of the following Apache Tomcat version is installed: 7, 8, 9, or 10. Refer to https://tomcat.apache.org/ for details.
Any of the supported Java version is installed on your machine. Refer to General system architecture for details.
JRE must be installed and JRE_HOME must be set. Alternatively, you can use JDK and set JAVA_HOME.
Steps
Install CADP for Java. Refer to Quick Start for details.
Copy
protectappws.war
from theCADP_for_JAVA\lib\webservices
directory to the%CATALINA_HOME%\webapps
directory. If Tomcat is running, it may automatically extract the contents to the%CATALINA_HOME%\webapps\protectappws
directory.Restart the Apache-Tomcat server.
Tip
While deploying the
protectappws.war
, if folder with same name already exists in the webapps folder, it should be deleted for clean deployment before starting Tomcat.Note
To deploy CADP for Java WebService on Apache Tomcat version 10.0.x, follow the steps mentioned below:
Create a folder named webapps-javaee in the Apache Tomcat 10 directory.
Place the
protectappws.war
file in the webapps-javaee folder.Run the startup batch file placed in the bin directory of Apache 10.
To deploy CADP for Java WebService on Apache Tomcat version 10.1.x, follow the steps mentioned below:
Download and extract Tomcat Migration Tool from here.
Navigate to
lib
directory of the downloaded zip file.Execute the following command in the terminal:
java -jar jakartaee-migration-*.jar <source> <destination>
where source is the complete path of current
protectappws.war
file and the destination will be the complete path of migrated war file.For example,
java -jar jakartaee-migration-*.jar protectappws.war migrated/protectappws.war
Place the migrated
protectappws.war
file in the webapps folder of Tomcat.Run the startup batch file placed in the
bin
directory of Apache 10.
To run CADP for Java WebService with Java 11 and higher versions, add the path of the following jar files in the classpath:
javax.activation-1.2.0.jar
jaxb-impl-2.3.1.jar
jaxb-api-2.3.1.jar
jaxb-core-2.3.0.1.jar
Important Points
Apache CXF gives the flexibility to deploy both REST and SOAP based services on a single web app (WAR). In this way, we have different end points for both the services, for example:
The list of WebService samples are available on Github page.
Configuring HTTPS Support for Tomcat
The APIs provided in CADP for Java WebService can be run over both HTTP and HTTPS protocols. The following section describes how to configure the HTTPS support.
To support HTTPS, perform the following steps:
Create a KeyStore attested with Certificate Authority (CA) or self-signed.
For self-signed KeyStore using Java, use the following command:
keytool -genkey -alias tomcat -keyalg RSA -keystore <keystore_name>.keystore
Edit the
server.xml
file under the/CATALINA_HOME/conf
directory. Add/uncomment the following changes in the connector port.<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" keystoreFile="<keystore_path>" keystorePass="changeit" clientAuth="false" sslProtocol="TLS" />
Where, keystoreFile is the path of keystore file generated in step 1 and
keystorePass
is the password used during the keystore generation.The changes in the
server.xml
file depends on the Tomcat server. The changes suggested in this step are for Tomcat 8 and 9.Restart the Tomcat server.
Check through browser for HTTPS: https://<host-name>:<Port>/