1 Reply Latest reply on May 27, 2008 11:39 AM by David Sancho

    Problems using handlers

    David Sancho Newbie

      Hi,

      I am trying to set a handler to a web method. The problem is that I think that everything is set fine and the execution is not even going trough it.

      This is my handler:

      package handlers;
      
      import java.util.Set;
      import java.util.TreeSet;
      
      import javax.xml.namespace.QName;
      import javax.xml.ws.handler.MessageContext;
      import javax.xml.ws.handler.soap.SOAPHandler;
      import javax.xml.ws.handler.soap.SOAPMessageContext;
      
      
      public class AuthenticationHandler implements SOAPHandler <SOAPMessageContext>{
      
       public Set<QName> getHeaders() {
       return new TreeSet<QName>();
       }
      
       public void close(MessageContext msgContext) {
       System.out.println("Closing");
       }
      
       public boolean handleFault(SOAPMessageContext msgContext) {
       System.out.println("FAULT");
       return true;
       }
      
       public boolean handleMessage(SOAPMessageContext msgContext)
       {
       System.out.println("MESSAGE");
       return true;
       }
      
      }
      
      


      It is packaged in WEB-INF/clasess/jaxws-location-handlers.xml and its config file is:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:ns1="http://org.jboss.ws/jaxws/handlerscope"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
      
       <handler-chain>
       <handler>
       <handler-class>handlers.AuthenticationHandler</handler-class>
       </handler>
       </handler-chain>
      
      </handler-chains>



      And this is how I am trying to use it in my web service (just say that the ws works perfectly):

      package ws.impl;
      
      public class ServiceImpl implements Service{
       ........
       ........
       @HandlerChain(file = "jaxws-location-handlers.xml")
       public String getItem(...){
       }
      }
      


      They are all together packaged in the same war file. I am using jbossws-2.0.3GA and Jboss-4.2.2.

      I do not know why it is not working, as it seems so easy to set it up. Do I have something wrong in the service? Any idea?

      Thanks a lot