Apache CXF Software Architecture Guide
This Software Architecture Document (web page) document provides an architectural overview of the Apache CXF services framework.
...
title | Note... |
---|
...
.
Table of Contents
Table of Contents | ||||
---|---|---|---|---|
|
Architectural Goals and Constraints
...
This extensibility is made possible by dependency injection; the default bus implemenation implementation is based on Springhttp://www.springsource.com/developer/spring Spring Framework, which wires the runtime components together for you.
...
META-INF/cxf/cxf.xml
(e.g., incxf-rt-core
only)META-INF/cxf/cxf-extension.xml
(e.g. incxf-rt-bindings-soap
)META-INF/cxf/cxf-property-editors.xml
(e.g. incxf-rt-transports-http
)
See Configuration of the Bus for an example of how to customize the bus by supplying your own bean configuration file and Configuration of Runtime Constructed Objects for more information on the special case of injecting into objects created by the runtime (as opposed to objects created by the IOC IoC container itself).
How service calls are processed
Gliffy Diagram | |||
---|---|---|---|
|
...
|
...
Client Side
Gliffy Diagram | ||||||
---|---|---|---|---|---|---|
|
Server Side
...
Front-ends
Front-ends provide a programming model to interact with CXF. JAX-WS, JAX-RS, Simple and Javascript front-end APIs are provided by CXF . Each implementation is cleanly separated from the rest of CXF, just like the bindings and the core. Front-ends provide functionality through interceptors that are added to Services and Endpoints. See also Front-ends
...
An interesting feature of the PhaseInterceptorChain
is that it is reentrant. This can be powerful and slightly dangerous. This feature is only used in CXF during the sending of an outgoing message, The SoapOutInterceptor
is the best example:
Code Block | ||||
---|---|---|---|---|
| ||||
public void handleMessage(Message m) {
writeSoapEnvelopeStart();
writeSoapBodyStart();
// invoke next interceptor, which writes the contents of the SOAP Body
m.getInterceptorChain().doIntercept(m);
writeSoapBodyEnd();
writeSoapEnvelopeEnd();
}
|
...
Data bindings implement the mapping between XML elements and Java objects. Data bindings convert data to and from XML, produce XML schema, and provide support for wsdl2java code generation. Not all data bindings support all of this functionality. At very least, a data binding must provide the data conversion. See Data Binding Architecture for details. Currently supported data bindings include JAXB 2.x (default) , Aegis, Apache XMLBeans, Service Data Objects (SDO) and JiBX (under development)and Aegis.
Protocol Bindings
Bindings provide ways to map concrete formats and protocols on top of transports. A binding contains two main parts, a BindingFactory
and a Binding
. A BindingFactory
builds a Binding
from the service model's BindingInfo
. The binding contains interceptors specific to the binding and also implements the createMessage()
method, which creates a Message
implementation specific for that binding.
...
The Soap
binding also adds a special type of interceptor called the SoapInterceptor
. The SoapInterceptor
adds two methods to the Interceptor
class:
Code Block | ||||
---|---|---|---|---|
| ||||
Set<URI> getRoles();
Set<QName> getUnderstoodHeaders();
|
...
StaxInInterceptor
: Creates anXMLStreamReader
from an incomingInputStream
ReadHeadersInterceptor
: Reads the headers into theSoapMessage
MustUnderstandInterceptor
: Checks theMustUnderstand
attributes of all the headers against all theSoapInterceptor
'sgetUnderstoodHeaders
method.SoapOutInterceptor
:
Additional Bindings
Other bindings include REST/HTTP
...
...
Pure XML Binding
...
CORBA Binding
...binding, pure XML binding, and the CORBA binding.
Transports
CXF includes its own transport abstraction layer to hide transport specific details from the binding and front end layers. Currently supported transports include: HTTP, HTTPs, HTTP-Jetty, HTTP-OSGI, Servlet, local, JMS, In-VM and many others via the Camel transport for CXF such as SMTP/POP3, TCP and Jabber. Learn more about transports here.
...
Destinations are the basis for receiving incoming messages. A destination is created from a DestinationFactory
:
Code Block | ||||
---|---|---|---|---|
| ||||
DestinationFactoryManager dfManager = bus.getExtension(DestinationFactoryManager.class);
// Find a DestinationFactory for the SOAP HTTP transport
DestinationFactory df = dfManager.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http");
// TODO: outline building of EndpointInfo
EndpointInfo endpointInfo = ...;
Destination destination = df.getDestination(endpointInfo);
|
MessageObservers can then be registered with Destinations. These listen for incoming messages:
Code Block | ||||
---|---|---|---|---|
| ||||
MessageObserver myObserver = ...;
destination.setMessageObserver(myObserver);
|
The most common MessageObserver
used in CXF is the ChainInitiationObserver
. This takes the incoming message, creates a message Exchange & PhaseInterceptorChain
, then starts the chain.
...
...
A JAX-WS example
Here's a small example of what might happen when we publish a service via the JAX-WS Endpoint.publish()
method.
...
Dependencies
Tooling
...
Build Support
...
Deployment View
...
Size and Performance
...
Quality
CXF's Software Quality approach is detailed here.
Appendix
Definitions, Acronyms and Abbreviations
...
.
References
- Software Architecture, Wikipedia
- Sample S/W Architecture Document, Rational Software Corporation
- Documenting your Software Architecture, by Jim Alateras (March 2006)