Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Referring people to Maven for setup.

...

This example corresponds to the hellojava_worldfirst_code_first jaxws example in the CXF distribution. IMPORTANT: This sample is only in CXF 2.0.1+!

Setting up your build

If you're using Maven to build your project have a look at this page.

Otherwise, 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. (note: the version numbers on these jars may be different if versions have changed)

Code Block

commons-logging-1.1.1.jar
geronimo-activation_1.1_spec-1.0.2.jar (or Sun's Activation jar)
geronimo-annotation_1.0_spec-1.1.1.jar (JSR 250)
geronimo-javamail_1.4_spec-1.6.jar (or Sun's JavaMail jar)
geronimo-servlet_2.5_spec-1.2.jar (or Sun's Servlet jar)
geronimo-ws-metadata_2.0_spec-1.1.2.jar (JSR 181)
geronimo-jaxws_2.1_spec-1.0.jar (or Sun's jaxws-api-2.1.jar)
geronimo-stax-api_1.0_spec-1.0.1.jar (or other stax-api jar)
jaxb-api-2.1.jar
jaxb-impl-2.1.12.jar
jetty-6.1.21.jar
jetty-util-6.1.21.jar
neethi-2.0.4.jar
saaj-api-1.3.jar
saaj-impl-1.3.2.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.8.jar
XmlSchema-1.4.5.jar
xml-resolver-1.2.jar

The Spring jars (optional - for XML Configuration support):

Code Block

aopalliance-1.0.jar
spring-core-2.5.5.jar
spring-beans-2.5.5.jar
spring-context-2.5.5.jar
spring-web-2.5.5.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 sayHi which says "Hello" to whoever submits their name.

...