Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Switched to Maven setup instead of manual JAR instructions.

...

This example corresponds to the java_first_spring_support example in the CXF distribution.

Setting up your build

Open up your favorite IDE and create a new project. The first thing we need to do is add the necessary CXF dependencies to the project. You can find these dependencies in the CXF distribution in the lib directory.

Code Block

commons-logging-1.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.7.1.jar (or Sun's JavaMail jar)
geronimo-servlet_3.0_spec-1.0.jar (or Sun's Servlet jar)
geronimo-ws-metadata_2.0_spec-1.1.1.jar (JSR 181)
jaxb-api-2.1.jar
jaxb-impl-2.1.13.jar
jaxws-api-2.1.jar
neethi-3.0.0.jar
saaj-api-1.3.jar
saaj-impl-1.3.jar
stax-api-1.0.1.jar
stax2-api-3.1.1.jar
wsdl4j-1.6.2.jar
woodstox-core-asl-4.0.8.jar
xmlschema-core-2.0.jar
xml-resolver-1.2.jar

The Spring jars:

Code Block

aopalliance-1.0.jar
spring-core-3.0.5.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
spring-web-3.0.5.RELEASE.jar

And the CXF jar:

...

The use of Apache Maven is recommended for your web service projects, as it will automatically bring in all necessary dependencies for your web service project. See the Maven pom.xml for this sample for the configuration needed. All samples provided by CXF use Apache Maven, except for the antbuild sample which shows how you can build CXF projects with Apache Ant instead.

The mvn dependency:list and mvn dependency:tree commands from the Maven Dependency Plugin will show all dependencies used by your project.

...

Writing your Service

First we'll write our service interface. It will have one operation called "sayHello" which says "Hello" to whoever submits their name.

...