Spring Web Services with SOAPUI
Web Services: A New Paradigm in Enterprise Computing?
Given the massive hype about web services over the last few years, I suppose it's an area that can hardly be called "new." However, as web services moves into the mainstream, I think it's helpful to look at the technology and the way it's being used in the industry.
The great merit of web services is the fact that it provides a flexible means of spreading computing power over the Internet. By hosting web services, company X can provide limited computing facilities to company Y. Used in this way, web services allows any organization to become a service provider. It's also straightforward to use web services within an organization.
With the widespread interest in web services, it's no surprise to learn that the Spring group has an offering called Spring web services. In this article, we'll examine one of the examples that comes as part of the Spring web services distribution. What does Spring do with web services that's a little different; what's the Spring value-add? A few things, actually! One is that users of Spring web services get all the benefits of the Spring approach. (If Spring is new to you, my article "Hit the Ground Running with the Spring Framework" may be of interest.) The benefits of Spring include application contexts, dependency injection, ease of configuration, and so on. Another major benefit of the Spring web services approach is the use of contract-first service design. I'll discuss this in more detail, but for the moment just think of it as a design approach that produces an interface (technically this a WSDL file) before writing the implementation.
In this article, I'll illustrate a simple web service and a tool called SOAPUI. It's called SOAP because SOAP is the underlying messaging protocol used for web services. Basically, a SOAP message has a header and a body. It's not a million miles away from the header and body sections in an IP packet. SOAPUI therefore can be used to interact with a web service—sending messages to the service and receiving responses where appropriate. As you'll see, SOAPUI is a powerful open source tool.