Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Spring Web Services Example

Available as of Camel 2.6

This example shows how to expose a SOAP-based web service using Camel and Spring Web Services.

Running the example

The example is included in the distribution at examples/camel-example-spring-ws. To start the example use Maven:

...

This will expose a web service on http://localhost:8080/incrementImage Removed. With help of a tool such as Soap-UI it's easy to sent messages to this endpoint. There's a ready to use SOAP-UI project available at examples/camel-example-spring-ws/client.

Code walk through

The Camel route that exposes the above web service is defined as:

...

Taking a closer look at the URI reveals that this route consumes messages with a certain rootqname. In this case it listens for messages with root element incrementRequest defined in the http://camel.apache.org/example/incrementImage Removed namespace. These XML messages are unmarshalled to Java objects using Camel's Data Format support. After processing the resulting object is marshalled back to XML and returned to the client.

...