O'Reilly logo

Java Web Services: Up and Running by Martin Kalin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The MessageContext and Transport Headers

This section considers how the JWS level of a service interacts with the transport level. The focus is on the MessageContext, which is normally accessed in handlers: the subtypes SOAPMessageContext and LogicalMessageContext are the parameter types, for example, in the handleMessage callbacks of SOAP and logical handlers, respectively.

The notion of context is a familiar one in modern programming systems, including Java. Servlets have a ServletContext, EJBs have an EJBContext (with appropriate subtypes such as SessionContext), and web services have a WebServiceContext. Seen in an architectural light, a context is what gives an object (a servlet, an EJB, a web service) access to its underlying container (servlet container, EJB container, web service container). Containers, in turn, provide the under-the-hood support for the object. Seen in a programming light, a context is a Map<String, Object>, that is, a key/value collection in which the keys are strings and the values are arbitrary objects.

It makes sense that the application level of a @WebService (that is, the SEI and the SIB) usually take the underlying MessageContext for granted, treating it as unseen infrastructure. At the handler level, the MessageContext is appropriately exposed as the data type of callback parameters so that a SOAP or a logical handler can access the SOAP messages and their payloads, respectively. This section examines the more unusual situation in which the MessageContext ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required