People use Spring-WS for many reasons, but most are drawn to it after finding alternative SOAP stacks lacking when it comes to following Web service best practices. Spring-WS makes the best practice an easy practice. This includes practices such as the WS-I basic profile, Contract-First development, and having a loose coupling between contract and implementation. The other key features of Spring Web services are:
Powerful mappings. You can distribute incoming XML request to any object, depending on message payload, SOAP Action header, or an XPath expression.
XML API support. Incoming XML messages can be handled in standard JAXP APIs such as DOM, SAX, and StAX, but also JDOM, dom4j, XOM, or even marshalling technologies.
Flexible XML Marshalling. The Object/XML Mapping module in the Spring Web Services distribution supports JAXB 1 and 2, Castor, XMLBeans, JiBX, and XStream. And because it is a separate module, you can use it in non-Web services code as well.
Reuses your Spring expertise. Spring-WS uses Spring application contexts for all configuration, which should help Spring developers get up-to-speed nice and quickly. Also, the architecture of Spring-WS resembles that of Spring-MVC.
Supports WS-Security. WS-Security allows you to sign SOAP messages, encrypt and decrypt them, or authenticate against them.
Integrates with Acegi Security. The WS-Security implementation of Spring Web Services provides integration with Acegi Security. This means you can use your existing Acegi configuration for your SOAP service as well.
Built by Maven. This assists you in effectively reusing the Spring Web Services artifacts in your own Maven-based projects.
Apache license. You can confidently use Spring-WS in your project.
Spring Web Services runs within a standard Java 1.3 Runtime Environment. It also supports Java 5.0, although the Java types which are specific to this release are packaged in a separate modules with the suffix "tiger" in their JAR filename. Spring-WS consists of a number of modules, which are described in the remainder of this section.
The XML module (spring-xml.jar
) contains various XML support classes for Spring Web
Services. This module is mainly targeted at the Spring-WS framework itself, and not a Web service
developers.
The Core package (spring-ws-core.jar
and spring-ws-core-tiger.jar
)
is the central part of the Web services
functionality. It provides the central
WebServiceMessage
and
SoapMessage
interfaces, the server-side
framework, with powerful message dispatching, and the various support classes for implementing Web service
endpoints; and the client-side WebServiceTemplate
.
The Security package (spring-ws-security.jar
)
provides a WS-Security implementation that integrates
with the core Web service package. It allows you to add principal tokens, sign, and decrypt and encrypt SOAP
messages. Addtionally, it allows you to leverage your existing Acegi security implementation for
authentication and authorization.
The OXM package (spring-oxm.jar
and
spring-oxm-tiger.jar
) provides integration for popular XML marshalling APIs, including
JAXB 1 and 2. Using the OXM package means that you benefit from a unified exception hierarchy, and can wire
up your favorite XML marshalling technology easily.
The following figure illustrates the modules, and the dependencies between them. Arrows indicate dependencies, i.e. Spring-WS Core depends on Spring-XML and Spring-OXM.