4 Replies Latest reply on Feb 14, 2008 8:48 AM by mageshbk

    handler problem

    khaledzarig

      Hi guys, I need to intercept the soap message at rhe server side,but it did not work. what i did is:
      1) i have this class:

      package org.jboss.ws.core.jaxws.handler;

      import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
      import javax.xml.ws.handler.MessageContext;
      public class HibernateWS extends GenericSOAPHandler
      {
      @Override
      public boolean handleFault(MessageContext msgContext)
      {
      System.out.println("Inside GenericSOAPHandler : ");
      return super.handleFault(msgContext);
      }
      @Override
      protected boolean handleInbound(MessageContext msgContext)
      {
      System.out.println("Inside GenericSOAPHandler : ");
      return true;
      }
      @Override
      protected boolean handleOutbound(MessageContext msgContext)
      {
      System.out.println("Inside GenericSOAPHandler : ");
      return true;
      }
      }

      and i have put the compiled file(.class) in package org.jboss.ws.core.jaxws.handler, ( i use jbossws 1.2.0 ).

      2) I added the following to standard-jaxws-endpoint-config.xml file which is in jboss-4.0.5.GA\server\default\deploy\jbossws.sar\META-INF;
      <endpoint-config>
      <config-name>Handler hibernate gnomo</config-name>
      <pre-handler-chains>
      <javaee:handler-chain>
      <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
      <javaee:handler>
      <javaee:handler-name>HibernateWS</javaee:handler-name>
      <javaee:handler-class>org.jboss.ws.core.jaxws.handler.HibernateWS</javaee:handler-class>
      </javaee:handler>
      </javaee:handler-chain>
      </pre-handler-chains>
      </endpoint-config>


      When i deployed my service it works as normal, but the handler doesn't print the messages as it is showen in the attached class (HibernateWS).

      can any body tell me what was wrong in this please.

      thanks in advance,
      khaly


        • 1. Re: handler problem
          khaledzarig

          Hi,
          this the simple source code i used in my web service:
          @Stateless
          @Remote(EJB3RemoteInterface.class)
          @RemoteBinding(jndiBinding = "/ejb3/EJB3EndpointInterface")
          @WebService
          @SOAPBinding(style = SOAPBinding.Style.RPC)
          public class EJB3Bean01 implements EJB3RemoteInterface
          {
          @WebMethod
          public String echo(String input)
          {
          return input;
          }
          }
          //------------
          public interface EJB3RemoteInterface
          {
          String echo(String input);
          }
          //----------

          and then i packaged them in jar file
          and deployed.

          can any body tell me what is wrong and why my handler doesnot print anything, please.
          any seggestion is appreciated

          • 2. Re: handler problem
            heiko.braun

            The first thing is not to put your handler in jbossws packages. Keep them private to your application, that is a custom package.
            In order to deploy it with your actual endpoint you need to specify a @HandlerChain that points to your handler declaration.
            Did you read the userguide?
            http://jbws.dyndns.org/mediawiki/index.php/JAX-WS_User_Guide

            • 3. Re: handler problem
              khaledzarig

              Hi,
              i am aware of this way (@HandlerChain ), but what i am trying to do is:
              Intecept soap message without the need to modify or add any code to the client or the endpoint code.
              I need something that helps me to intercept any soap message comes in or out of the jboss server.
              So, is there a way of doing this, please

              • 4. Re: handler problem
                mageshbk

                Yes you can. You can modify the standard templates available here

                server\<config>\deploy\jbossws.sar\META-INF\standard-jaxws-endpoint-config.xml
                server\<config>\deploy\jbossws.sar\META-INF\standard-jaxrpc-endpoint-config.xml
                


                See http://labs.jboss.com/jbossws/user-guide/en/html/1.0.4/en/html/endpoints.html section "4.4. Endpoint configuration templates"