axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J.Sug...@pilz.ie
Subject RE: Adding a custom handler
Date Tue, 01 Mar 2005 11:06:00 GMT
Thanks - 

That worked perfectly. 

I had made the mistake of extending the wrong handler (BasicHandler) which 
doesn't seem to appear in the handler chain.

Thanks for the solution.

James




Alick Buckley <Alick.Buckley@lansa.com.au> 
28/02/2005 21:14
Please respond to
axis-user@ws.apache.org


To
axis-user@ws.apache.org
cc

Subject
RE: Adding a custom handler







I have the following working 
========================================================================= 
  QName portName = stub.getPortName () ; 
  Service service = stub._getService () ; // Axis 1.2 RC2 
  HandlerRegistry handlerRegistry = service.getHandlerRegistry () ; 
  List handlerChain = handlerRegistry.getHandlerChain ( portName ) ; 
  MyHandlerInfo handlerInfo = new MyHandlerInfo () ; 
  handlerInfo.setHandlerClass ( MyHandler.class ) ; 
  handlerChain.add ( handlerInfo ) ; 
  handlerRegistry.setHandlerChain ( portName, handlerChain ) ; 
========================================================================= 
  public class MyHandler implements Handler 
  { 
    public void init ( HandlerInfo handlerInfo ) throws JAXRPCException 
    { 
        if ( handlerInfo instanceof MyHandlerInfo ) 
        { 
        } 
    } 
    public void destroy () throws JAXRPCException 
    { 
    } 
    public QName[] getHeaders () 
    { 
        return new QName[0] ; 
    } 
    public boolean handleFault ( MessageContext messageContext ) throws 
JAXRPCException 
    { 
        return true ; // return true to continue processing 
    } 
    public boolean handleRequest ( MessageContext messageContext ) throws 
JAXRPCException 
    { 
        SOAPMessage message = 
((SOAPMessageContext)messageContext).getMessage () ; 
        return true ; // return true to continue processing 
    } 
    public boolean handleResponse ( MessageContext messageContext ) throws 
JAXRPCException 
    { 
        return true ; // return true to continue processing 
    } 
========================================================================= 

-----Original Message----- 
From: J.Sugrue@pilz.ie [mailto:J.Sugrue@pilz.ie] 
Sent: Tuesday, 1 March 2005 3:26 AM 
To: axis-user@ws.apache.org 
Subject: Adding a custom handler 

Hi. 
I'm writing a client side Axis application, in which I need to create my 
own custom handler. 
I'm using WSDL2Java to generate my code stubs, and I was hoping that I 
could add a handler as follows: 
                                HandlerRegistry registry  = 
service.getHandlerRegistry(); 
                                QName portName = s.getPortName(); 
                                List handlerChain = 
registry.getHandlerChain(portName); 
                                HandlerInfo handlerInfo = new 
HandlerInfo(); 
 handlerInfo.setHandlerClass(com.foo.MyHandler); 
                                handlerChain.add(handlerInfo); 
                                registry.setHandlerChain(portName, 
handlerChain); 

But when I run the client application, it would seem this handler is not 
called as both the handleRequest and handleResponse methods produce no 
output (I've added in System.out's to them to see if it works) 
Does anyone have any ideas of what I may be missing? 
Thanks. 
James 

This email is intended solely for the use of the named addressee(s). Any 
unauthorised disclosure, copying or distribution of the confidential 
information contained therein, or the taking of any action based on it, is 

prohibited. The sender disclaims any liability for the integrity of this 
email. Legally binding declarations must be in written form. 

This email is intended solely for the use of the named addressee(s). Any 
unauthorised disclosure, copying or distribution of the confidential 
information contained therein, or the taking of any action based on it, is 
prohibited. The sender disclaims any liability for the integrity of this 
email. Legally binding declarations must be in written form.


Mime
View raw message