In this tutorial we will integrate Spring WS 2 and Spring 3 MVC.
We will develop a Spring WS web service that follows a Contract-First development.
The method takes a Subscription Request as a parameter, annotated with @Request Payload.
This means that the payload of the message is passed on this method as a DOM element.
First let's see the actual XML document that is sent to us by the client: Take note that this XML format is not arbitrary!
The client has to honor the format that we declared in the XSD document.
Using Java's object-oriented approach and XML approach is not really convenient when manipulating information.
Therefore we will use marshalling techniques to map the XML document with a corresponding Java object.Here's our XSD document: This XSD is comprised of simple and complex element types.Each simple element has been assigned with restriction.It's highly recommended to read first the Spring WS: A Tutorial Using the Latest 2.0.0 RC2 Build because that's the foundation of this tutorial. Spring Web Services (Spring-WS) is a product of the Spring community focused on creating document-driven Web services.Spring Web Services aims to facilitate contract-first SOAP service development, allowing for the creation of flexible web services using one of the many ways to manipulate XML payloads.In this way we can filter data even before it comes to our service. Spring WS will handle the validation based on these restrictions.