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;
}
}
<?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>
package ws.impl;
public class ServiceImpl implements Service{
........
........
@HandlerChain(file = "jaxws-location-handlers.xml")
public String getItem(...){
}
}
Just in case someone had the same problem I found my mistake. I was annotating the method instead of annotating the class.