Spring Web Services 2.0: Best Java Stack for SOAP-based Web Services
A major version of the Spring Web service project Spring WS 2.0 recently was released after a year in development. This version requires that your project use Java 5 or above and Spring 3.0 or above, but the upgrade (if necessary) is well worth it because Spring WS 2.0 delivers a lot of goodies for Java developers. New features include:
- An improved, more flexible
- A new integration testing framework for both server-side and client-side testing
- Java 5 APIs (generics, varargs), and more
For developers who are not familiar with Spring WS, it is a Spring portfolio project that lets you build Spring-based, document-oriented SOAP Web services. Spring WS is very different from other Java SOAP stacks as it is supports only the contract first Web service development style, it focuses on XML messages, and it does no code generation (except for dynamic generation of WSDL from XSD).
I have been experimenting with Spring WS 2.0 during the past several days . In this article, I will share some my experiences with the parts of the project that I have used--so this is not an exhaustive overview by any means. In future posts, I will cover the left over pieces. For now, I show you how you can create a simple SOAP Web service using Spring WS 2.0.
Creating a New Spring WS 2.0 Project
Using a Maven archetype, it is very easy to create a new Spring WS project. Please make sure that you have Maven 2 installed on your system and type the following command:
mvn archetype:create -DarchetypeGroupId=org.springframework.ws -DarchetypeArtifactId=spring-ws-archetype -DarchetypeVersion=2.0.0.RELEASE -DgroupId=com.shekhar.usermanagement -DartifactId=profileService
This command will create a Maven2-based Spring WS project with all the required configurations. The two files apart from pom.xml that this archetype will create are spring-ws-servlet.xml and web.xml. The web.xml is a standard Web application deployment descriptor, which maps all (
/*) incoming requests to MessageDispatcherServlet. The spring-ws-servlet.xml contains all the Spring-WS-related beans, such as endpoints, WebServiceMessageReceivers, interceptors, and so on. The name of this file is the concatenation of the name of servlet defined in web.xml and "-servlet.xml". The name of the servlet is "spring-ws", so the Spring WS XML file name is "spring-ws-servlet.xml".
Originally published on http://www.developer.com.
Page 1 of 2