Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Can we intercept Web Services?

Sunny,

There are three things to note here:

1) The call to the serviceMethod is being made through reflection (the axis
Call.invoke method), so you won't be able to match it through a call
pointcut to the method signature. See
http://www.eclipse.org/aspectj/doc/released/faq.html#q:reflectiveCalls for
more discussion about that. In this case you probably want to advise the
call to the Axis Call method, e.g.,

    public pointcut jaxRpcClientCall(Call wsCallObj) :
        call(public * Call.invoke*(..)) && target(wsCallObj);

See
https://glassbox-inspector.dev.java.net/source/browse/glassbox-inspector/Gla
ssboxInspector/src/glassbox/inspector/monitor/resource/RemoteCallMonitor.aj?
only_with_tag=HEAD for an example of doing this to monitor remote calls from
Axis.

2) The call is made in the Client, so you would want to weave into the
Client to track the Call.

3) You can advise execution(public String MyService.serviceMethod(String))
and if you weave into the server it will do what you, too. See
http://www.eclipse.org/aspectj/doc/released/faq.html#q:comparecallandexecuti
on for more on the differences between call and execution pointcuts.

In general, the weaver has to affect (weave into) the calling class to
affect method calls and the called class to affect method executions.

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Sunny Saxena
Sent: Wednesday, January 11, 2006 4:55 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Can we intercept Web Services?

I tried the following, I dont know whether it should
work or not.

I have one of the sample
services(samples/userguide/example3) that come with
Axis up. And its running fine. If I write an aspect
like: 

public aspect IntMyService {
	before() : call (public String serviceMethod(String))
{
		System.out.println("Before typed message");
	}
}

and recompile the classes using ajc, and then if i run
the client, should the aspect intercept? I tried doing
it and it did not work. Can anyone check this.

Since Axis is in java and i have access to the code as
well. I think this should work.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top