Tomcat Axis2

My requirement is to configure Axis2 to listen to HTTPS calls. I am using Tomcat as my servlet container. So the question is how to configure Axis2 for HTTPS within Tomcat.

Tomcat7 / Axis2. Hello everybody, We have a Tomcat 7 and Axis 2 for our Java SOAP web service over https on our Ubuntu server. We also use C3PO connection pooling (also in other web services which. Apache Axis2 is built on Apache AXIOM, a new high performant, pull-based XML object model. Axis2 comes with many new features, enhancements and industry specification implementations. The key features offered are as follows. The Apache Tomcat software is developed in an open and participatory environment and released under the Apache License version 2. The Apache Tomcat project is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project. Please delete axis2.war and the axis2 directory from the webapp folder of the tomact when tomcat is stopped. Then start tomcat and see that axis2 is removed successfully. After that put axis2.war again to webapp directory.

Let TOMCAT_HOME = {Location where you installed Tomcat}
1. Download Tomcat 7
2. Download latest Axis2 version
3. Install Tomcat 7
4. Drop Axis2 WAR distribution to $TOMCAT_HOME/webapps.
5. Unzip Axis2 WAR distribution

Now start Tomcat server.
- Go to $TOMCAT_HOME/bin
- Type > sh ;tail -f ../logs/catalina.out (Assuming you are in Unix)

Try accessing http://localhost:8080/axis2
You should see Axis2 home page. There you will see links to list services, validate installation and to administer installation.

Now try to access HTTPS URL - https://localhost:8080/axis2 Oops !! This will say the secure connection failed. In FireFox you will get an error code 'ssl_error_rx_record_too_long'.

Inherently you cannot have a single port for HTTPS and HTTP. In above we were trying to access HTTPS URL from HTTP port. Server does not have a valid certificate to provide in that URL. Therefore browser truncates the connection, saying 'ssl error'

So what is the port which HTTPS runs ? This we havent configured yet.

Configuring SSL for Tomcat
Axis2Step 1 - Creating self signed certificates and keystores
Type following in a command line
> keytool -genkey -alias tomcat -keyalg RSA -keystore tomcat.jks -keysize 2048
Answer the questions prompted.
Step 2 - Making configuration changes
1. Go to Tomcat configuration directory (E.g :- ~/development/Tools/webservers/apache-tomcat-7.0.23/conf)
2. Open server.xml
3. Uncomment following configurations,
<Connector port='8443' protocol='HTTP/1.1' SSLEnabled='true'
maxThreads='150' scheme='https' secure='true'
clientAuth='false' sslProtocol='TLS' />
4. Specify above created Keystore files
<Connector port='8443' protocol='HTTP/1.1' SSLEnabled='true'

Tomcat Axis2 Example

keystoreFile='/home/amila/development/apache/rampart-v2-tests/jks/tomcat-jks/tomcat.jks' keystorePass='tomcat' keyPass='password'
maxThreads='150' scheme='https' secure='true'
clientAuth='false' sslProtocol='TLS' />
Now we configured SSL for Tomcat on port 8443. Lets try accessing https://localhost:8443. You should see Tomcat page. Now try accessing https://localhost:8443/axis2/. You will also see Axis2 home page. OK, so far so good. Now try to list services in Axis2 - https://localhost:8443/axis2/services/listServices.
Hmm... Strangely you will not see any services. List services page may depict an 'Internal Server Error'.
The reason for this behavior is we have not configured HTTPS transport in Axis2 level. We only configured Tomcat. Inorder for Axis2 to be fully functional on HTTPS we also need to configure HTTPS transport in axis2.
Configuring HTTPS in Axis2
1. Go to $TOMCAT_HOME/webapps/axis2/WEB-INF/conf
2. Open axis2.xml
3. Locate transportReceiver - By default you will see only HTTP transport receiver
4. Configure HTTPS transport receiver and ports
i.e. Modify HTTP transport receiver with port parameter and add HTTPS transport receiver, as follows;
<transportReceiver name='http'
<parameter name='port'>8080</parameter>

Axis2 Tomcat Version

<transportReceiver name='https'
<parameter name='port'>8443</parameter>

Now you should be able to list services through - https://localhost:8443/axis2/services/listServices.
More Reading
[1] Java Keystores -
[2] Apache Axis2 -
[3] Tomcat -

Tomcat Axis

Axis2 Tomcat 8