...
This tutorial uses the following frameworks:
- Maven 23.0.94
- Apache Camel 2.10.0
- Apache CXF 2.6.1
- Spring 3.0.7
...
Then we integration the CXF wsdl2java generator in the pom.xml so we have CXF generate the needed POJO classes for our webservice contract.
However at first we must configure maven to live in the modern world of Java 1.5 6 so we must add this to the pom.xml
Code Block | ||||
---|---|---|---|---|
| ||||
<!-- to compile with 1.56 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5<6</source> <target>1.5<6</target> </configuration> </plugin> |
...
Now that the code compiles we would like to run it in inside a web container, so we add jetty to our pom.xml so we can run mvn jetty:run
for this purpose we make use of Jetty which we will bootstrap using it's plugin org.mortbay.jetty:maven-jetty-plugin
:
Code Block | ||||
---|---|---|---|---|
| ||||
<properties> ... <jetty-version>6.1.1</jetty-version> </properties> <build> <plugins> ... <!-- so we can run mvn jetty:run --> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>${jetty-version}</version> </plugin> |
Notice: We make use Jetty v6.1.1 as never versions has troubles on my laptop. Feel free to try a newer version on your system, but v6.1.1 works flawless.of the Jetty version being defined inside the Camel's Parent POM.
So to see if everything is in order we fire up jetty with mvn jetty:run
and if everything is okay you should be able to access http://localhost:8080
.
Jetty is smart that it will list the correct URI on the page to our web application, so just click on the link. This is smart as you don't have to remember the exact web context URI for your application - just fire up the default page and Jetty will help you.
So where is the damn webservice then? Well as we did configure the web.xml to instruct the CXF servlet to accept the pattern /webservices/*
we should hit this URL to get the attention of CXF: http://localhost:8080/camel-example-reportincident/webservices
.
Hitting the webservice
...