This discussion is archived
1 Reply Latest reply: Feb 22, 2013 5:57 AM by 945123 RSS

JAX-WS handler not running

945123 Newbie
Currently Being Moderated
I have a very simple web service. I would like to use a handler with the web service.
I followed the directions here:
http://docs.oracle.com/cd/E21764_01/web.1111/e13734/handlers.htm#i222335

I am using the HandlerChain annotation in the jws file:
@HandlerChain(file="security-context-handler.xml")

These are the contents of the security-context-handler.xml:
<?xml version="1.0" encoding="UTF-8"?>
<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
<handler-chain>
<handler>
     <handler-name>SecurityContextHandler</handler-name>
<handler-class>xxx.xxx.soaphandlers.SecurityContextHandler</handler-class>
</handler>
</handler-chain>
</handler-chains>

Here is the handler:
package xxx.xxx..soaphandlers;

import java.util.Set;
import java.util.Collections;
import javax.xml.namespace.QName;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPMessage;

public class SecurityContextHandler implements SOAPHandler<SOAPMessageContext>
{
@Override
public Set<QName> getHeaders()
{ System.out.println("getHeaders()\n");
return Collections.emptySet();
}
@Override
public boolean handleMessage(SOAPMessageContext messageContext)
{  System.out.println("handleMessage()\n");
return true;
}

@Override
public boolean handleFault(SOAPMessageContext messageContext)
{ System.out.println("handleFault()\n");
return true;
}

@Override
public void close(MessageContext messageContext)
{ System.out.println("Close()\n");
}
}

I can see the compiled handler class in the WAR file. When the web service is invoked it completes without error, but the handler never runs (it only has a System.out.println()).

I tried turning off the "Work Context Propagation Enabled" flag in the domain where the web service application is deployed, but that did not work.

What could I have done wrong? How may I enable a JAX-WS web service handler in weblogic?
Any pointers or advice are greatly appreciated.

Thank you.
S

Edited by: 942120 on Feb 15, 2013 8:24 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points