Chapter 5. SOAP Handlers and Faults

SOAP messages have some similarity to the HTTP messages that commonly transport them. Each type of message, SOAP and HTTP, can have a header and a body, although the header in a SOAP message is optional. In HTTP 1.1, there must be a header with at least the one key/value pair, with Host as the key, but HTTP headers usually contain at least a half dozen or so header elements. A SOAP message must have a body, which can be, but typically is not, empty. Not every HTTP message has a body, of course, with GET and DELETE messages as two bodyless examples. In each kind of message, the header, if present, is meant to contain metadata; the body, if present, is meant to contain data.

SOAP has a messaging architecture that centers on the different uses envisioned for the SOAP header and the SOAP body. At the base level of this architecture is the SOAP message, a one-way transmission from a sender to a receiver. The fundamental message exchange pattern (MEP) is thus one-way. SOAP-based applications such as web services are free to establish conversational patterns that combine one-way messaging in richer ways, for example, in the familiar request/response pattern that involves two one-way messages in the opposite direction. Even request/response and solicit/response are brief conversational patterns but these, too, can be combined to construct even richer patterns. There is no limit to how complex a SOAP conversational pattern may become.

A SOAP message has ...

Get Java Web Services: Up and Running, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.