JAX-RPC Handlers – Why do we use it?
A handler is a component that can be associated with an entire Web service or with a particular Web service interface. JAX-RPC handlers allow you to intercept a SOAP message at various times during a service invocation. Several handlers can be combined into what is called a “handler chain”. We use the handlers in order to achieve the below
1. An authentucation component to process SOAP headers containing credentials
2. To encrypt meesagge before we can send it across the network
3. To show SOAP message content specific logging actions can be undertaken
4. To calculate the time taken to process a SOAP message
A handler is a java class that implements the javax.xml.rpc.handler.Handler interface. It has three methods (handleRequest, handleResponse, and handleFault) to handle SOAP requests, responses and faults, respectively.
public abstract interface javax.xml.rpc.handler.Handler extends java.lang.Object {
public abstract boolean handleRequest(MessageContext context);
public abstract boolean handleResponse(MessageContext context);
public abstract boolean handleFault(MessageContext context);
public abstract void init(HandleInfo info);
public abstract void destory();
public abstract QName[] getHeaders;
};

0 Comments.