Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added the discription of the web service provider example

...

CXF example for using the WebServiceProvider

JAXWS API provides the WebServiceProvider API to meet the requirement of XML lever message handling. This example is to show how to route an SOAP Message from a WebServiceProvider implementor to bean endpoint in the Camel context. Basically , we still pass the WebServiceProvider implementor as SEI, and the camel-cxf consumer will pass the SOAP Message in a list of parameter to camel router for further processing.

First, let's have a look at the Camel context's configuration. Here we start a camel-cxf consumer to listen to the address and pass soap message to the test bean.

Wiki Markup
{snippet:id=example|lang=xml|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/resources/org/apache/camel/example/cxf/provider/CamelCXFRouteConfig.xml}

Here is the WebServiceProvider implementor's annotation , we just want to handle SOAPMessage in the Message mode

Wiki Markup
{snippet:id=e1|lang=java|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/GreeterProvider.java}

Since the cxf-camel component will replace the cxf invoker to call the processor when start a cxf endpoint, the cxf-camel consumer will never call the provider implementor's invoke method here.

Wiki Markup
{snippet:id=e2|lang=java|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/GreeterProvider.java}

Now we can implement the bean for handling the invocation of the SOAP message

Wiki Markup
{snippet:id=e1|lang=java|url=activemq/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/TesterBean.java}