Chapter 8. Alternative Techniques

Although SOAP is most commonly used for RPC, there are other possibilities as well. SOAP can also be used to create message-style services in which a SOAP envelope is sent to a server without the requirement that anything be returned to the caller. The message can contain any payload that is appropriate for the service — it doesn’t have to look like a procedure call. This is similar to the way email systems work. When you send an email, you don’t get anything back from the server, and there aren’t any rules about what the email can contain. The server accepts your message and does its job without any more involvement from the sender. This is in sharp contrast to RPC services, where a return value is an integral part of the method invocation process.

Not all SOAP implementations support message-style services, but these services can be a useful model and are well worth investigating. GLUE doesn’t support message services, but Apache SOAP does, so we’ll use Apache SOAP to develop some examples.

The Apache SOAP API for message-style services is a lower level API than the one we’ve been using for RPC. This shouldn’t be surprising, since RPC works by sending messages back and forth. The RPC API is built on top of the message API and includes some useful abstractions that make writing RPC services and service clients relatively easy. You won’t find any such convenience in the Apache SOAP message service world. Instead you’ll have to work with the lower ...

Get Java and SOAP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.