This example will lead you through creating your first service with Spring. You'll learn how to:
- Set up your build for CXF
- Writing a simple JAX-WS service
- Set up the HTTP transport
This example corresponds to the spring_http 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.
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.0.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) jaxb-api-2.1.jar jaxb-impl-2.1.2.jar jaxb-xjc-2.1.2.jar jaxws-api-2.0.jar jsr181-api-1.0-MR1.jar saaj-api-1.3.jar saaj-impl-1.3.jar stax-api-1.0.1.jar wsdl4j-1.6.1.jar wstx-asl-3.2.0.jar XmlSchema-1.2.jar
The Spring jars:
aopalliance-1.0.jar spring-2.0.jar
And the CXF jars:
cxf-api-2.0-incubator-RC-SNAPSHOT.jar cxf-common-schemas-2.0-incubator-RC-SNAPSHOT.jar cxf-common-utilities-2.0-incubator-RC-SNAPSHOT.jar cxf-metacode-2.0-incubator-RC-SNAPSHOT.jar cxf-rt-bindings-soap-2.0-incubator-RC-SNAPSHOT.jar cxf-rt-core-2.0-incubator-RC-SNAPSHOT.jar cxf-rt-databinding-jaxb-2.0-incubator-RC-SNAPSHOT.jar cxf-rt-frontend-jaxws-2.0-incubator-RC-SNAPSHOT.jar cxf-rt-frontend-simple-2.0-incubator-RC-SNAPSHOT.jar cxf-rt-management-2.0-incubator-RC-SNAPSHOT.jar cxf-rt-transports-http-2.0-incubator-RC-SNAPSHOT.jar cxf-tools-common-2.0-incubator-RC-SNAPSHOT.jar
Writing your Service
Declaring your beans
Setting up the Servlet (optional)
Advanced Steps
For more information on using Spring you may want to read the Configuration and Spring sections of the User's Guide.