Handler Problem

From: Abe Zafar <>
Date: Mon, 19 May 2003 18:49:24 -0600

I like to use a Handler for authentication. I like to pass a username and password as part of the SOAP message. Unfortunately the callback methods in my handler never get called so I don't think the handler is properly registered. It would have been nice if I would get an exception as oppose to a silent failure which is tough to debug. Need your help. Thanks in advance.

Here is the code that registers the handler:

QName portName = new QName( "http://com.test/wsdl", "CreatePeople");
Service service = new CreatePeople_Impl();
ArrayList handlers = new ArrayList();
handlers.add(new HandlerInfo( DefaultHandler.class, null, null ) );
service.getHandlerRegistry().setHandlerChain( portName, handlers );

Here is the content of my config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="">
   <wsdl location="http://localhost:8080/mjplus-deployable/create-people?WSDL"

Here is the content of jaxrpc-ri.xml:

<?xml version="1.0" encoding="UTF-8"?>

        displayName="CreatePeople Service"
        description="CreatePeople Webservice"


Here is the Handler class:

package com.rhi.mjplus.ui.handler;

import java.util.Hashtable;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.rpc.handler.Handler;

public class DefaultHandler implements Handler {

    public DefaultHandler() {

    public void init(HandlerInfo config) {
        System.out.println(" In StockServerHandler.init ()");

    public boolean handleFault(MessageContext context) {
        System.out.println(" In StockServerHandler.handleFault (), context=" + context);
        return true;

    public boolean handleRequest (MessageContext context) {
        System.out.println(" In StockServerHandler.handleRequest ()");
        return true;

    public boolean handleResponse (MessageContext context) {
        System.out.println(" In StockServerHandler.handleResponse ()");
        return true;

    public javax.xml.namespace.QName[] getHeaders() {
        System.out.println(" In StockServerHandler.getHeaders ()");
        return null;

    public void destroy() {
        System.out.println(" In StockServerHandler.destroy ()");