The Handler Level in SOAP-Based Services and Clients

Figure 5-3 shows the structure of a SOAP message. In SOAP over HTTP, such a message is itself the body of either an HTTP request, typically a POST request, or an HTTP response. The message consists of:

  • The SOAP part, which comprises the SOAP envelope, which in turn consists of an optional header and a required body. The body can be, but typically is not, empty. The header and the body are text, in particular XML.
  • Arbitrarily many attachments, including none. Attachments are an efficient way to transport media types such as audio or video as binary payloads belonging to a SOAP message.
The structure of a SOAP message

Figure 5-3. The structure of a SOAP message

SOAP attachments are covered later in this chapter. For now, the distinction between the SOAP header and the SOAP body is of interest because this difference is a way to focus on two related but separate SOAP APIs: an API for what might be called the application level and a separate API for what might be called the handler level. (This distinction roughly mirrors, in Java-based websites, the distinction between the servlet API and the filter API, although servlets and filters occur only on the server side.) The application and handler levels occur on the service side and on the client side. In the examples so far, the focus has been on the application level with the use of annotations such as @WebService ...

Get Java Web Services: Up and Running, 2nd Edition 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.