// to see if the current iterator handler is intended for this service.
// TODO review: need to check for null getHandlerClass() return?
// or will schema not allow it?
String portHandler = handlerType.getHandlerClass().getValue();
Handler handler;
// Create temporary MessageContext to pass information to HandlerLifecycleManager
MessageContext ctx = new MessageContext();
ctx.setEndpointDescription(ed);
HandlerLifecycleManager hlm = createHandlerlifecycleManager();
// instantiate portHandler class
try {
handler = hlm.createHandlerInstance(ctx, loadClass(portHandler));
} catch (Exception e) {
// TODO: should we just ignore this problem?
// TODO: NLS log and throw
throw ExceptionFactory.makeWebServiceException(e);
}
// 9.2.1.2 sort them by Logical, then SOAP
if (LogicalHandler.class.isAssignableFrom(handler.getClass()))
handlers.add((LogicalHandler) handler);
else if (SOAPHandler.class.isAssignableFrom(handler.getClass()))
// instanceof ProtocolHandler
handlers.add((SOAPHandler) handler);
else if (Handler.class.isAssignableFrom(handler.getClass())) {
// TODO: NLS better error message
throw ExceptionFactory.makeWebServiceException(Messages
.getMessage("handlerChainErr1", handler
.getClass().getName()));
} else {
// TODO: NLS better error message
throw ExceptionFactory.makeWebServiceException(Messages
.getMessage("handlerChainErr2", handler
.getClass().getName()));
}
}
}