title: Registering soap handler at client side using java
body: <pre><code>public class MySoapHandler implements SOAPHandler&lt;SOAPMessageContext&gt; {
  
    @Override
    public boolean handleMessage(SOAPMessageContext context) {
  
      Map&lt;String, String&gt; prop = Client.getProperties();
  
      System.out.println("Client : handleMessage()......");
  
      Boolean isRequest = (Boolean) context
          .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
      SOAPMessage message = context.getMessage();
  
      // if this is a request, true for outbound messages, false for inbound
  
      if (isRequest) {
  
        try {
  
      }
      } 
    }
  ...
  ...
  
  }
  </code></pre>
  
  <p>in my main class , from where i send soap request contains code to register the handler:</p>
  
  <pre><code>  QName portName = new QName("MySoapHandler");
    HandlerRegistry registry =
      service.getHandlerRegistry(); List handlerList = new ArrayList();
      handlerList.add(new HandlerInfo(MySoapHandler.class, null,
      null)); registry.setHandlerChain(portName, handlerList); 
  </code></pre>
  
  <p>It is not working . What should i do? I have got a legacy code to work upon. I am unable to understand how to do it. </p>