CXF provides a broad variety of touch points which your application can take advantage of. This guide should give you an overview of some of the features and options at your disposal.
CXF works with many different transports. Currently CXF includes support for HTTP, JMS, and Local (that is, "in-JVM") transports. The local transport is unique in that it will not work across machines, but simply sends messages in memory. You can also configure the local transport to avoid serialization by using the Object binding or the colocation feature if desired. You can also write your own transport.
Bindings map a particular service's messages to a particular protocol. CXF includes support for several different bindings. The SOAP binding, which is the default, maps messages to SOAP and can be used with the various WS-* modules inside CXF. The Pure XML binding avoids serialization of a SOAP envelope and just sends a raw XML message. There is also an HTTP binding which maps a service to HTTP using RESTful semantics.
Message Interception and Modification
Many times you may want to provide functionality for your application that works at a low level with XML messages. This commonly occurs through functionality referred to as Handlers or Interceptors. Handlers/Interceptors are useful for:
- Performing authentication based on Headers
- Processing custom headers
- Transforming a message (i.e. via XSLT or GZip)
- Redirecting a message
- Getting access to the raw I/O or XML stream
If you are using the JAX-WS frontend, JAX-WS supports the concept of logical and protocol handlers. Protocol handlers allow you to manipulate the message in its raw, often XML-based, form - i.e. a SAAJ SOAPMessage. Logical handlers allow you to manipulate the message after its already been bound from the protocol to the JAXB object that your service will receive. See this article to learn more about JAX-WS handlers.
Interceptors provide access to all the features that CXF has to offer - allowing you to do just about anything, including manipulating the raw bytes or XML of the message.
Transmitting Binary Data
CXF provides facilities to transmit binary data efficiently via a standard called MTOM. Normally binary data inside an XML message must be Base64 encoded. This results in processing overhead and increases message size by 30%. If you use MTOM, CXF will send/receive MIME messages with the message stored as a MIME attachment, just like email. This results in much more efficient communication and allows you to transmit messages much larger than memory.
CXF provides support for a variety of WS-* specifications.
Invokers allow you to customize how a particular method or backend service object is executed. This is particularly useful if your underlying service objects are not plain javabeans and instead need to be created or looked up via a custom factory.