Spring-WS: Contract first web-services for Spring
Many web-service platforms make web-services easy by simply SOAP-ifying an object's interface. That's certainly a quick way to get started with web-services, but what happens when the object's interface changes?
The contract between a web-service and its clients is often determined in a “contract-last” approach. That is, the service is designed and developed with little or no thought put into how a client will interact with it. Then WSDL is generated on-the-fly when the object is deployed. As a result, the contract is coupled to the service implementation's interface.
The promise of SOA is a network of loosely-coupled services that can be assembled into larger applications. But if the contract is coupled to the service implementation's interface, then the client is also indirectly coupled to that same interface. When the service implementation changes, the client must also change.
Thus we have the classic versioning issue associated with web-services. When a service's contract changes, you can't realistically expect all of its clients to change right away.
One solution is to never change the service–design it up-front with everything it will ever need and never change it again. But this isn't very practical, as there's no way to predict what impact future requirements will have on the service. Yet another approach is to deploy multiple versions of the service. But this adds to the maintenance costs by having to juggle multiple versions.
Another option that is gaining a lot of attention lately is the notion of contract-first web-services. The contract-first approach is message-centric. Instead of treating web-services as “RPC with angle-brackets”, contract-first treats web-services as message receivers. In doing so, a web-service can be written in such a way as to decouple its from contract from its implementation.
In this session, we'll take a look at Spring-WS, a Spring-based web-service framework for building contract-first web-services.
About Craig Walls
Craig Walls is a Principal Engineer, Java Champion, Alexa Champion, and the author of Spring AI in Action, Spring in Action, and Build Talking Apps. He's a zealous promoter of the Spring Framework, speaking frequently at local user groups and conferences and writing about Spring. When he's not slinging code, Craig is planning his next trip to Disney World or Disneyland and spending as much time as he can with his wife, two daughters, 1 bird and 2 dogs.
More About Craig »