Since Domino 6 I have only seen people use Apache Axis (up to 1.4) as a web service framework and quite frankly it’s a bit long in the tooth; we want to use a newer framework and if we are sticking with the popular frameworks (i.e. native support in Eclipse), that leaves us with Axis 2 and CXF (yes yes! I know that X or Y is the latest and greatest but given the sedentary nature of large corporations I’ll settle for a functionally rich, well-rounded standard that works and in 2 years time can still be supported).
Anyhow, all my clients seem to have plumped for CXF, so this blog is to show you how to get a CXF client working on Domino 8+ (CXF needs Java 5 or greater).
I am assuming that you have already generated your class files (either via Eclipse wizards or via wsdl2J). If you have not, this is a good Link:
Normally when you are writing / testing a Java agent you just bung the supporting jar files in the agent itself, and give it a run. Unfortunately even if you get all the right jar files, you will get this error:
This means that CXF can’t verify your WSDL (yes it’s a naff error) due to security reasons, so you’re going to have to put the jar files in the ext directory on the server.
CXF uses more jar files than Axis. When you download the binary from http://cxf.apache.org you will find a “WHICH_JAR” text file in the lib directory that tells you which files you will need to include for which function. As my client is using quite a few of the extra functions (such as WS security), I ended up putting the following files in a directory called “CXF” inside the Dominojvmlibext directory (the extra sub-directory is just so I don’t get the files mixed up):
– sl4j.jar & sl4j-jdk14.jar (optional – but improves logging)
(NOTE: If you are already using Java heavily in domino you may already some of these in your ext directory, so be careful to not double-up or give yourself conflicts).
The next bubble of joy will be the following error message (or something very similar):
This is a security message, and means you will have to edit the dominojvmlibsecurityjava.policy file. The exact entry will depend on the error you are getting, but this one:
… meant I put the following lines in:
Restart your server and that should be it, your CXF calls should work fine.
PS. I have included full error messages to help future lost souls find this post.
PPS. This posts was corrected and sanitised by Mr Poole to make it readable (thank you)
##### Olle Thalen(05/01/2011 14:11:04 GMT)
I get the following exception all the time when I try to run a web service consumer using cxf in domino environment:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 24 in XML document from class path resource [META-INF/cxf/cxf.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans’.
Got any ideas?