Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Requirement

We should support to deploy cxf client(as service consumer) and cxf server (as service provider) easilly into servicemix.
We need a cxf service engine where we can deploy cxf client and server. As a service engine (SE) provides some type of logic inside the JBI environment and only communicates with the NMR. If a Cxf SE needs to communicate outside the JBI environment (e.g. the client inside servicemix but server outside servicemix or vice verse), it must send a message to a binding component (via the NMR), so we also need a cxf binding component to bridge the incoming/outcoming message. And we should leverage ws-* feature of CXF by cxf binding component.

key component

cxf service engine

overview

ServiceMix Cxf Se component is a JBI Service Engine exposing (annotated) POJO as services on the JBI Bus.
It reuses JBI binding and JBI transport of apache cxf internally to perform service invocations and xml marshaling.
Here for how-to-use cxf se.

features for cxf service engine

  • jsr181 annotations
  • jaxb2 binding
  • wsdl auto generation
  • java proxy support
  • MTOM / attachments support

main class for cxf service engine

CxfSeComponent

We use maven-xbean-plugin to generate component xbean schema, so we need add comment to specify the xml element name firstly

Code Block
langjava

/**
 * 
 * @org.apache.xbean.XBean element="component"
 */

This class just extends servicemix DefaultComponent
Which is JBI spec compitable component. By extends servicemix DefaultComponent, we can only focus cxf specific issue for our cxf service engine since all JBI spec details is handled by servicemix DefaultComponent. Here we just init cxf bus when CxfSeComponent init.

Code Block
langjava

@Override
    protected void doInit() throws Exception {
        bus = BusFactory.getDefaultBus();
        super.doInit();
    }

CxfSeEndpoint

We use maven-xbean-plugin to generate endpoint xbean schema, so we need add comment to specify the xml element name firstly

Code Block
langjava

/**
 * 
 * @org.apache.xbean.XBean element="endpoint"
 */

CxfSeProxyFactoryBean

configureation

cxf binding component

overview

ServiceMix ships with a JBI compliant HTTP/SOAP or JMS/SOAP binding component named servicemix-cxf-bc which use apache cxf internally.
Here for how-to-use cxf bc.

features for cxf binding component

  • JBI compliant Binding Component
  • Usable in a lightweight mode in servicemix.xml configuration files
  • SOAP 1.1 and 1.2 support
  • MIME attachments
  • Support for InOut or InOnly MEPs as consumers or providers
  • SSL support
  • WS-Security support
  • WS-Policy support
  • WS-RM support
  • WS-Addressing support

main class for cxf binding component

configuration

typical use case