Hi Malik,
Malik M Junaid wrote:
Hello all,
I am a student and want to write axis handlers for the Globus Toolkit
for intercepting the services communications. Can anyone please kindly
help me in this regard or refer me to a tutorial where i can learn how
can i do this.
this is bascially very easy. Just extend your handler from
org.apache.axis.handlers.BasicHandler and implement the invoke()
operation, for example like this (a simple timer that computes message
processing time):
Logger log = Logger.getLogger(SimpleTimerHandler.class)
public void invoke(MessageContext msgContext) throws AxisFault {
log.info("Engine handler: " + msgContext.getStrProp("engine.handler"));
log.info("Transport name: " + msgContext.getTransportName());
long currentTime = System.nanoTime();
if ( ! msgContext.getPastPivot() ) {
msgContext.setProperty("timerStart", new Long(currentTime));
return;
} else {
Long timerStart = (Long) msgContext.getProperty("timerStart");
long elapsed = currentTime - timerStart.longValue();
log.info(msgContext.getOperation().getName() + ":" + elapsed);
}
}
Then, in the server-config.wsdd of your service, add this into the
"service" tag:
<requestFlow>
<handler name="Timer-1"
type="java:fully.qualified.name.of.your.handler" />
</requestFlow>
<responseFlow>
<handler name="Timer-2"
type="java:fully.qualified.name.of.your.handler" />
</responseFlow>
Or if there is any other way of intercepting the service communication
other than the Apache Axis Handlers approach kindly guide me about that.
My preference is to do minimum interaction with the service container
and the service itself.
I don't know of any other way, but the handlers are quite nice anyway.
Kind regards,
Roland
--
Dipl.-Inf. Roland Kübert
Höchstleistungsrechenzentrum Stuttgart
Universität Stuttgart
Nobelstraße 19
70569 Stuttgart
Phone: +49 711 685 65802
Fax: +49 711 685 65832
Skype: rkuebert