Name

Handler

Synopsis

public interface Handler {
// Public Instance Methods
    public abstract void destroy(  ); 
    public abstract javax.xml.namespace.QName[ ] getHeaders(  ); 
    public abstract boolean handleFault(MessageContext context); 
    public abstract boolean handleRequest(MessageContext context);
    public abstract boolean handleResponse(MessageContext context);
    public abstract void init( HandlerInfo config); 
}

The Handler interface defines the methods that must be implemented by a message handler. The init( ) and destroy( ) methods mark the beginning and end of the handler’s life cycle. The init( ) method receives a Map containing property values that are typically set from a configuration file such as the jaxrpc-ri.xml file used by wsdeploy, the config.xml used by wscompile, or the webservices.xml file supplied to the J2EE 1.4 j2eec utility. The getHeaders( ) method returns the URIs of all of the headers that the handler can process, in the form of an array of javax.xml.namespace.QName objects. A handler whose processing is not directly related to a header should return an empty array.

The handler processing is carried out by the handleRequest( ), handleResponse( ), and handleFault( ) methods, which are called for an outgoing message, an incoming message that is not a fault, and a fault, respectively. Each of these methods is passed a MessageContext object that handlers can use to store state that can then be read by other handlers in the chain. The MessageContext object can also be used ...

Get Java Web Services in a Nutshell 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.