Skip to main content Skip to complementary content

JAX-WS Overview

Architectural aspects of CXF include the following:

Spring Integration

Spring is a first class citizen with Apache CXF. CXF supports the Spring 2.0 XML syntax, making it trivial to declare endpoints which are backed by Spring and inject clients into your application.

Transports

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.

Support for Various Databindings between XML and Java

CXF provides support for multiple data bindings, including JAXB, XML Beans, and Aegis Databinding (2.0.x), is our own databinding library that makes development of code-first web services incredibly easy. Unlike JAXB, you don't need annotations at all. It also works correctly with a variety of datatypes such as Lists, Maps, Dates, etc. right out of the box. If you're building a prototype web services that's really invaluable as it means you have to do very little work to get up and running.

Bindings

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

JAX-WS Handlers

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.

Interceptors

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.

Invokers

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.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!