Webservices -- Apache CXF with SpringThis is a featured page

In this tutorial I explain how to get a web service up and running using Spring 2.5 and Apache CXF 2.0. Here I just treat the web service itself; to learn about consuming the web service using Spring and CXF, please see the article Make Web Services Transparent with Spring 2.5 and Apache CXF 2.0.

CXF supports both WSDL-first and Java-first web service development. This article takes the Java-first approach.

Project Setup


The first thing you'll need to do is download CXF from the Apache CXF site. At the time of this writing the project is in incubator status and the latest version is 2.0.4. That's the version I'm using.

You'll also find it useful to know about the section of the CXF user documentation that deals with writing a service with Spring, but currently the docs describe how to integrate with Spring 2.0, and since I want to integrate with Spring 2.5, there are some differences worth highlighting along the way.

Also, the docs describe a "Hello, World" web service that just returns a string, and in this tutorial we want to go a little further than that and actually do a class databinding.

Here are the service-side dependencies you'll need. Inside the distribution there is a file called WHICH_JARS that describes in a little more detail what the JARs are for and which ones you'll really need, if you're interested in that. But the following is essentially the list given in the user docs.
CXF itself

* cxf-2.0.4-incubator.jar

CXF dependencies

Note that for CXF 2.0.4 the documented dependencies are almost but not quite the same as the JARs that are actually included in the distribution, once again, at the time of this writing (February 2008). Specifically the stax, neethi and XMLSchema JARs are not the ones listed. Here's the corrected list for CXF 2.0.4:

* commons-logging-1.1.jar
* geronimo-activation_1.1_spec-1.0-M1.jar (or Sun's Activation jar)
* geronimo-annotation_1.0_spec-1.1.jar (JSR 250)
* geronimo-javamail_1.4_spec-1.0-M1.jar (or Sun's JavaMail jar)
* geronimo-servlet_2.5_spec-1.1-M1.jar (or Sun's Servlet jar)
* geronimo-stax-api_1.0_spec-1.0.jar
* geronimo-ws-metadata_2.0_spec-1.1.1.jar (JSR 181)
* jaxb-api-2.0.jar
* jaxb-impl-2.0.5.jar
* jaxws-api-2.0.jar
* neethi-2.0.2.jar
* saaj-api-1.3.jar
* saaj-impl-1.3.jar
* wsdl4j-1.6.1.jar
* wstx-asl-3.2.1.jar
* XmlSchema-1.3.2.jar
* xml-resolver-1.2.jar



emocat
emocat
Latest page update: made by emocat , Mar 21 2008, 1:11 PM EDT (about this update About This Update emocat Moved from: The Official Oracle Wiki - emocat

No content added or deleted.

- complete history)
Keyword tags: JAX-WS Spring Webservices
More Info: links to this page
There are no threads for this page.  Be the first to start a new thread.

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)