How to run Rampart Samples with Apache Tomcat

  • By Ruchith Fernando
  • |
  • 28 Sep, 2008

Applies To

  • Apache Rampart - 1.4
  • Apache Axis2 - 1.4.1

http://ws.apache.org/axis2/

http://ws.apache.org/rampart/

You need to have the following to try this:

- Apache Axis2 Standard Binary Distribution (Version 1.4.1)
- Apache Axis2 WAR (Web Archive) Distribution (Version 1.4.1)
- Apache Rampart Standard Binary Distribution (Version 1.4)
- Apache Tomcat
- Apache Ant
- Make sure you have patched your JRE with Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.

The policy/sample03 of Apache Rampart samples will be used to demonstrate this. You can use the same steps to deploy and run other samples as well.

Step 1:

Extract Apache Axis2 war distribution and copy axis2.war into the "webapps" directory of Apache Tomcat.

Stop Apache Tomcat.

Step 2:

Extract Apache Axis2 Standard binary distribution and Apache Rampart standard binary distribution and,

- Download and copy bcprov-jdk**-140.jar from bouncycastle.org to <extracted-rampart-dist>/lib/

- Set AXIS2_HOME environment variable to the extracted Apache Axis2 Standard binary distribution directory.

- Run 'ant' from the samples directory to copy all required jars into the <extracted-rampart-dist>/lib to setup classpath to run the clients.

- Update the addressing.mar property of build.xml file of samples/policy to :

- To build the service archive, change directory to <extracted-rampart-dist>/samples/policy/ and do
$ 'ant service.03'

This will start the simple axis2 server, you can simply stop it using Ctrl+C.
If you have Apache Tomcat started at this point there might be a conflict of ports when axis2 server is trying to start!

Step 3:

Now we have the client and the service ready! Lets move the secured service to the Axis2 instance in Tomcat.

- Make sure Tomcat not running
- Copy all jar files in <extracted-rampart-dist>/lib/ directory to <tomcat>/webapps/axis2/WEB-INF/lib/
- Copy rampart-1.4.mar to <tomcat>/webapps/axis2/WEB-INF/modules/
- Copy <extracted-rampart-dist>/samples/policy/build/service_repositories/sample03/services/sample03.aar into <tomcat>/webapps/axis2/WEB-INF/services/
- Note that the required keys are packed with the service archive.
- Start Apache Tomcat!
- If you are running tomcat on port 8080 you should be able to point your browser to https://localhost:8080/axis2/services/listServices and verify that the secured service is successfully hosted!

Step 4: Running the client

- Simply change directory to "<extracted-rampart-dist>/samples/policy/" and do
$ ant client.03

Author:

Ruchith Fernando, ruchithf AT apache.org

 

About Author

  • Ruchith Fernando
  • Software Engineer
  • WSO2 Inc.