Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: undefined "soapDataFormat" variable fixed.

...

Code Block
SoapJaxbDataFormat soapsoapDF = new SoapJaxbDataFormat("com.example.customerservice", new ServiceNameStrategy(CustomerService.class));
from("direct:customerServiceClient")
  .onException(Exception.class)
    .handled(true)
    .unmarshal(soapsoapDF)
  .end()
  .marshal(soapsoapDF)
  .to("http://myserver/customerservice")
  .unmarshal(soapDataFormatsoapDF);

Webservice Server

Using the following route sets up a webservice server that listens on jms queue customerServiceQueue and processes requests using the class CustomerServiceImpl. The customerServiceImpl of course should implement the interface CustomerService. Instead of directly instantiating the server class it could be defined in a spring context as a regular bean.

Code Block
SoapJaxbDataFormat soapsoapDF = new SoapJaxbDataFormat("com.example.customerservice", new ServiceNameStrategy(CustomerService.class));
CustomerService serverBean = new CustomerServiceImpl();
from("jms://queue:customerServiceQueue")
  .onException(Exception.class)
    .handled(true)
    .marshal(soapsoapDF)
  .end()
  .unmarshal(soapsoapDF)
  .bean(serverBean)
  .marshal(soapDataFormatsoapDF);

Dependencies

To use the SOAP dataformat in your camel routes you need to add the following dependency to your pom.

...