1 Reply Latest reply on Mar 11, 2009 4:57 AM by David Sancho

    Handler execution order in handler chain

    David Sancho Newbie

      Hi,

      I have defined three handlers in a handler chain as follows:

      <?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-name>Handler 1</handler-name>
       <handler-class>
       test.HandlerOne
       </handler-class>
       </handler>
       <handler>
       <handler-name>Handler 2</handler-name>
       <handler-class>
       test.HandlerTwo
       </handler-class>
       </handler>
       <handler>
       <handler-name>Handler 3</handler-name>
       <handler-class>
       test.HandlerThree
       </handler-class>
       </handler>
       </handler-chain>
      
      </handler-chains>
      


      I thought that the handler execution order was going to be: handler 1, handler 2 and handler 3. But what really happened was that handlers were executed in reverse order, that is: Handler 3, handler 2, and handler 1.

      My handlers implement javax.xml.ws.handler.soap.SOAPHandler and I am using jbossws 3.0.4.GA.

      How can I set the handler execution order ? Are handlers in handler chain executed in reverse order as they are defined in the handler definition?


      Thanks in advance,

      David Sancho


        • 1. Re: Handler execution order in handler chain
          David Sancho Newbie

          This is how it works, taking the descriptor file from last post:

          Handlers in server side
          - Server in:
          1) Handler 3
          2) Handler 2
          3) Handler 1
          - Server out:
          1) Handler 1
          2) Handler 2
          3) Handler 3

          Handlers in client side
          - Client out:
          1) Handler 1
          2) Handler 2
          3) Handler 3
          - Client in:
          1) Handler 3
          2) Handler 2
          3) Handler 1

          See HandlerChainExecutor class.

          Cheers,

          David Sancho