3 Replies Latest reply on Jun 24, 2015 9:15 AM by sach2014

    SOAP Interceptor

    zeeshan.javeed

      Hi All,
      I am trying to intercept soap request. I have followed the instruction of @handler annotation but request never pass throught the Handler class. Anybody, having any idea...

      here is the code.

      in the start of the implementation class:

      @WebService(name = "webservice")
      @HandlerChain (name = "SoapHandler" , file = "WEB-INF/handler.xml")


      handler.xml class is
       <?xml version="1.0" encoding="UTF-8"?>
      
      <handler-config>
       <handler-chain>
       <handler-chain-name>SoapHandler</handler-chain-name>
       <handler>
       <handler-name>testSOAPHandler</handler-name> <handler-class>my.webservice.impl.SOAPHandler</handler-class>
       </handler>
       </handler-chain>
      </handler-config>
      
      



      and code for Soap handler class is :
      
      package my.webservice.impl;
      
      import javax.xml.namespace.QName;
      import org.jboss.ws.core.jaxws.handler.*;
      
      import javax.xml.rpc.handler.HandlerInfo;
      import javax.xml.rpc.handler.MessageContext;
      
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      
      /**
       *
       * @version $Revision: 1 $
       */
      @Revision("$Revision: 1 $")
      public class SOAPHandler extends GenericHandler
      {
       /**
       * Logger
       */
       private static final Log log = LogFactory.getLog(WipeSOAPHandler.class);
      
       /** SOAP headers */
       protected QName[] headers;
      
      
      
       /**
       * @see javax.xml.rpc.handler.GenericHandler#init(javax.xml.rpc.handler.HandlerInfo)
       */
       public void init(HandlerInfo info)
       {
       log.info("init: " + info);
       System.out.println("Init section");
       this.headers = info.getHeaders();
       }
      
      
       /**
       * @return
       * @see javax.xml.rpc.handler.GenericHandler#getHeaders()
       */
       public QName[] getHeaders()
       {
       return this.headers;
       }
      
       /**
       * @return
       * @see javax.xml.rpc.handler.GenericHandler#handleRequest(javax.xml.rpc.handler.MessageContext)
       */
       public boolean handleRequest(MessageContext context)
       {
       log.debug("+++> handleRequest");
      
       return true;
       }
      
       /**
       * @param context
       * @return
       * @see javax.xml.rpc.handler.GenericHandler#handleResponse(javax.xml.rpc.handler.MessageContext)
       *
       *
       *
       */
       public boolean handleResponse(MessageContext context)
       {
       log.debug("+++> handle SOAP response:");
      
      
       return true;
       }
      
      
      }
      
      
      




      .....
      I am not getting any help... plz help out...

      Regards,
      Zeeshan

        • 1. Re: SOAP Interceptor
          asoldano

          Are you using jax-ws or jax-rpc? I guess jax-ws since you use annotation, however you're importing and extending jax-rpc handler classes (javax.xml.rpc.handler.*).

          Please take a look at the org.jboss.test.ws.jaxws.samples.handlerchain sample, it's a working example using handlers you can copy&paste from.
          http://jbws.dyndns.org/mediawiki/index.php?title=Samples

          • 2. Re: SOAP Interceptor
            zeeshan.javeed

            Thanks alot Alessio Soldano.
            It worked now.
            Can you please also have a look at
            http://www.jboss.com/index.html?module=bb&op=viewtopic&t=125421

            and tell me why two clients generated from same contract sending different soap messages ? It is very important for me to understand this.

            Regards,
            Zeeshan Javeed.

            • 3. Re: SOAP Interceptor
              sach2014

              Hi,

              Revisiting this old thread. Am trying to adopt the same approach to intercept the soap request in jboss, but i do not have much information on where to make the configuration changes so that the custom handler will get invoked when soap request is sent to jboss. In my case, i have only wsdl and there is no webservice deployed on jboss. The task is to intercept the soap request and to perform some custom operation on that request. Is there any web.xml configuration available to provide the endpoint to send request.. Thanks.