axis-axis1-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pasquale Imbemba <>
Subject Custom SOAP message Handler
Date Sat, 01 May 2010 13:53:26 GMT

I'm developing a webservice client with Java. I'd like to use a Handler to
intercept the
SOAP requests the client makes for logging purposes.
I need to have this done by code - no xml configurations. I'm using

So far, I got to this point:
I have a class ( that extends
This class implements all necessary inherited methods from the abstract
There is no logic yet, I just do sysouts in every method and put a
breakpoint on them,
to see if it enters any of these.

I then have a class ( with a method that returns a service upon
which I consume the remote method:
1) InterService is = null;
2) try {
3) WSLocator servLocator = new WSLocator();
4) servLocator.setWSEndpointAddress(endpointURL);
5) HandlerRegistry hr = servLocator.getHandlerRegistry();
6) QName portName = new QName(endpointURL, remMethodName);
7) List handlerChain = hr.getHandlerChain(portName);
8) HandlerInfo hi = new HandlerInfo();
9) hi.setHandlerClass(SpecialHandler.class);
10) handlerChain.add(hi);
11) hr.setHandlerChain(portName, handlerChain);
12) is = servLocator.getWSRemoteService();
13) WSUtils.addAuthHeader((Stub) is, user, pwd, remMethodName, log);

What I do is: I retrieve the handlerRegistry from the serviceLocator, create
a new
QName with valid endpointURL and remMethodName (they're passed to this
method), retrieve a
list of handlerchains with that QName, create a new HandlerInfo, set it with
the class with
my handler logic, add it to the list and set the list back to the handler
registry. Line 13) is just to add an auth header to the request.

I presume that everytime a "request" event is created, thread execution
should stop on the handleRequest method
of the SpecialHandler.class, but it doesn't. It executes the call of the
remote method however (i.e. it sends a request indeed).

In debug mode, I see that the is (i.e. the service) has indeed the
handlerregistry set (with my SpecialHandler).

Am I missing something (crucial)?

Thanks in advance,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message