Despite doing several Web Service implementations over the last couple years, I have successfully avoided using Apache Axis until now. A client's Web Service implementation was incompatible with the code generation tools available in more modern Web Service clients, such as Apache CXF. While there is documentation around using Axis 2 with AEM, there isn't really anything available for Axis 1 in AEM which is what I needed to use. So, I rolled up my sleeves and dug in.
Challenge 1: Axis 1.4 as a Bundle
The first challenge I ran into is that Apache Axis 1.4 is not created as a bundle. Thanks to some googling (now simplified with 6D's Bundle Finder), I found that the Apache Geronimo project produced a bundled version of Apache Axis. Awesome! I added the bundle as a dependency in my content project and embedded it into the package I'm building, based on the following dependency:
org.apache.geronimo.bundles axis 1.4_2
After installing the bundle, the OSGi console lit up like a Christmas tree with unresolved dependencies. Back to the drawing board!
Challenge 2: Dependency Hell
To get Axis to actually work in AEM, I had to track down all of the dependencies, find the bundle version, install the dependency bundle into AEM and check it's dependencies. This took a while and I needed to re-wrap a couple of the dependencies as OSGi bundles to get them installed in AEM. I created a couple projects to rewrap the two dependencies not available as OSGi bundles, commons-discovery and jaxrpc-api:
After everything is said and done, to get Axis 1.4 working you'll need to embed all of the following dependencies into an AEM package or install them into the Felix console:
com.sixdimensions.commons.osgi.wrapper commons-discovery 0.5 com.sixdimensions.commons.osgi.wrapper jaxrpc-api 1.1 org.apache.servicemix.bundles org.apache.servicemix.bundles.ant 1.7.0_5 org.apache.servicemix.bundles org.apache.servicemix.bundles.castor 0.9.6_3 org.apache.servicemix.bundles org.apache.servicemix.bundles.cglib 2.1_3_7 org.apache.servicemix.bundles org.apache.servicemix.bundles.oro 2.0.8_5 org.apache.servicemix.bundles org.apache.servicemix.bundles.regexp 1.3_3 org.apache.servicemix.bundles org.apache.servicemix.bundles.wsdl4j 1.6.2_5 org.apache.servicemix.bundles org.apache.servicemix.bundles.xerces 2.10.0_1 org.apache.servicemix.bundles org.apache.servicemix.bundles.xmlresolver 1.2_5
Challenge 3: SSL Configuration
At this point, I had Axis 1.4 working in AEM, but I also needed it to connect to the endpoint using 2-Way SSL authentication. There are a couple of difficulties which come up specifically when working with SSL, Axis 1.4 and AEM:
- SSL Configuration - unfortunately, due to how Axis 1.4 handles SSL configuration, you can only specify the keystore, truststore and ssl logging information via command line arguments at startup. For whatever reason, if you attempt to set this later (for example in a Service activator) via
System.setProperty, the SSL client will already be initialized and does not re-read the properties. To get this to work, you will need to update your start script to add parameters like the following:
-Djavax.net.debug=all -Djavax.net.ssl.keyStore=/opt/some/dir/keystore.jks -Djavax.net.ssl.keyStorePassword=apassword
- Logging SSL Information - the only way to debug them is to set the system property
javax.net.debugto all and check the stdout.log. Unfortunately, this log file does not rotate and the only can be changed by restarting AEM. Thus, I would recommend adding the
java.net.debugparameter only on development instances and ensuring you are clearing this log on startup.
Once I updated the crx-quickstart/bin/start script to properly set the SSL configuration values, I was able to interact with the Web Service endpoint without any further issues.
Hopefully this post helps you get Axis 1.4 working in AEM! Please leave a comment if you find anything else useful or have any questions.