Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In chapter 8, you saw how to use JaxRpcPortProxyFactoryBean and XFireClientFactoryBean to build clients that communicate with remote web services. But both of those take a remote object view of web services, treating web services as remote objects whose methods can be invoked locally. Throughout this chapter, we’ve been talking about a message-centric approach to web services where clients send XML messages to a web service and receive XML messages back in response. A different paradigm on the service side demands a different paradigm on the client side as well. That’s where Spring-WS’s WebServiceTemplate comes in.
WebServiceTemplate is the centerpiece of Spring-WS’s client API. As shown in figure 9.10, it employs the Template design pattern to provide the ability to send and receive XML messages from message-centric web services. We’ve already seen how Spring uses the Template pattern for its data access abstractions in chapter 5. As we look at Spring-WS’s client API, you’ll find that it resembles the data access API in many ways.