To invoke a Web Service upon sending a message to a channel, there are two options:
SimpleWebServiceTargetAdapter
and
MarshallingWebServiceTargetAdapter
. The former will accept either a
String
or javax.xml.transform.Source
as the message
payload. The latter provides support for any implementation of the Marshaller
and Unmarshaller
interfaces. Both require the URI of the Web Service to be
called.
simpleAdapter = new SimpleWebServiceTargetAdapter(uri); marshallingAdapter = new MarshallingWebServiceTargetAdapter(uri, marshaller);
As with the other target adapters, this can then be referenced from a MessageEndpoint
that is subscribed to a channel. The endpoint is then responsible for passing the response to the proper
channel. It will first check for a returnAddress on the original message's header, and it
will fallback to the endpoint's own default output channel.
For more detail on the inner workings, see the Spring Web Services reference guide's chapter covering client access as well as the chapter covering Object/XML mapping.