Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Grails + CXF Example

Ok, we've been trying to get full fledged web services (providing) working in Grails for quite a while, it felt like it should be easy, as all the bits were there, but all of the plugins to date were more proof of concept vs Enterprise ready (e.g. no control over namespaces).

So, the target was to get CXF running with the following key requirements:

  • WSDL First
  • Minimal change required to CXF generated interface classes
  • Bound to Grails services so we can re-use business logic and interact with domain classes

Step 1:  Grails App + CXF

Create a simple Grails application (working from the ground up is the best way to explain it, rather than trying to explain our existing application), create a simple domain class, controller and service.

Download Apache CXF (I used 2.1):  http://cxf.apache.org/ and extract somewhere on your PC.

Copy the following libraries from the CXF Installation over into your Grails application lib folder:

XmlSchema-1.4.2.jar
commons-logging-1.1.1.jar
cxf-2.1.jar
cxf-manifest.jar
geronimo-activation_1.1_spec-1.0.2.jar
geronimo-annotation_1.0_spec-1.1.1.jar
geronimo-javamail_1.4_spec-1.3.jar
geronimo-jms_1.1_spec-1.1.1.jar
geronimo-servlet_2.5_spec-1.2.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
geronimo-ws-metadata_2.0_spec-1.1.2.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.6.jar
jaxb-xjc-2.1.6.jar
jaxws-api-2.1-1.jar
neethi-2.0.4.jar
saaj-api-1.3.jar
saaj-impl-1.3.jar
wstx-asl-3.2.4.jar
xml-resolver-1.2.jar
asm-2.2.3.jar
stax-utils-20060502.jar
jaxen-1.1.jar
jdom-1.0.jar

Next, add a resources.xml file to your grails-app/conf/Spring folder:

Next, install templates for your app (grails install-templates), then go into src/templates/war and edit web.xml, add the following:

Next, ensure that you turn off the inbuilt URL Mapping for the /ws/* in conf/UrlMapping.groovy:



  • No labels