Spring Web Services (Spring-WS) is one of the projects developed by the Spring Community. Its prime focus is to create document-driven Web Services. The Spring Web Services project facilitates contract-first SOAP Service Development, provides multiple ways to create flexible web services, which can manipulate XML payloads in multiple ways.
The Spring web services uses Spring concepts like dependency injection and configurations seamlessly. The Spring-WS requires Spring 3.0 Version. With contract-first development, we start with WSDL Contract and then will use JAVA to implement the required contract.
As opposed to the contract-last approach where JAVA interfaces generate WSDL/XSD contract. The WSDL based contract remains independent of JAVA implementation in the contract-first approach. In case we require changing the JAVA interfaces, then there is no need to communicate the changes made in the existing WSDL contract to the web services users. Spring-WS aims to provide loose coupling between the WSDL contract and its JAVA based implementation.
Following are the features of Spring Web Services −
XML Mapping to Objects − XML based requests can be mapped to any object using the information stored in the Message Payload, SOAP Action Header or by using an XPath Expression.
Multiple API Support to parse XML − Apart from the standard JAXP APIs (DOM, SAX, StAX) to parse the incoming XML requests, other libraries like JDOM, dom4j, XOM are also supported.
Multiple API Support to marshal XML− Spring Web Services supports JAXB 1 and 2, Castor, XMLBeans, JiBX, and XStream libraries using its Object/XML Mapping module. The Object/XML Mapping module can also be used in non-web services code as well.
Spring based configurations − Spring Web Services uses the Spring Application Contexts for its configurations having a similar architecture as that of the Spring Web MVC.
Integrated WS-Security module − Using the WS-Security module, you can Sign, Encrypt, Decrypt SOAP Messages or Authenticate them.
Support for Acegi Security − Using the WS-Security implementation of Spring Web Services, Acegi configuration can be used for your SOAP services.
The Spring-WS project consists of five major modules, which are explained below.
Spring-WS Core − It is the primary module and provides the Central Interfaces like WebServiceMessage and SoapMessage, the server-side framework, powerful message dispatching capability and support classes to implement Web service endpoints. It also provides Web Service consumer client as WebServiceTemplate.
Spring-WS Support − This module provides supports for JMS, emails, etc.
Spring-WS Security − This module is responsible to provide WS-Security implementation integrated with core Web Service Module. Using this module, we can add principal tokens, sign, encrypt and decrypt SOAP messages. This module allows using the existing Spring Security Implementation for authentication and authorization.
Spring XML − This module provides XML support classes for Spring Web Services. This module is internally used by Spring-WS framework.
Spring OXM − This module provides support classes for XML vs Object Mapping.