Java Reference
In-Depth Information
public Set<QName> getHeaders() {
return null;
}
}
Implementing the SOAPHandler interface gives you access to SOAP-specific properties, such
as SOAP headers, in the messages to be handled. There are a few methods you need to imple-
ment, but the main one is handleMessage .
Now that you have a handler, you need to make it accessible to the service proxy. The way
to do this is to associate it with a resolver. The handler resolver specifies the handlers in the
chain for the service instance you set it on. The implementation for the resolver is shown in
Example 6-11 .
Example6-11.HelloHandlerResolver.java
package com.soacookbook.ch03.handler;
import java.util.ArrayList;
import java.util.List;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.HandlerResolver;
import javax.xml.ws.handler.PortInfo;
import org.apache.log4j.Logger;
public class HelloHandlerResolver implements HandlerResolver {
private static final Logger LOGGER =
Logger.getLogger(HelloHandlerResolver.class);
private final List<Handler> chain;
//constructor. we'll set up chain here.
public HelloHandlerResolver() {
chain = new ArrayList<Handler>();
chain.add(new SaveMessageHandler());
}
public List<Handler> getHandlerChain(PortInfo portInfo) {
LOGGER.debug("Returning handler chain...");
return chain;
}
}
Each handler implementation acts within the context of a HandlerChain . A HandlerChain is
similar in concept to a filter chain, which allows the programmer to specify multiple handlers
Search WWH ::




Custom Search