[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Intercepting web services... ;)
|
Sunny,
It seems to me that you wish to advise
the execution of your "serviceMethod()". The aspect that you
now have (using the execution rather than call point) woven against your
service class (not Axis or any other part of the system) is the right approach.
However I suspect that you don't have aspectrt.jar on the classpath; your
advised service needs this because it depends on the Cept aspect and all
aspects have a dependency on the NoAspectBoundException class which is
in the library. It would be more helpful if you used "e.printStackTrace()"
when catching exceptions as you have thrown away a lot of information including
the root cause which is probably a NoClassDefFoundError.
Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester, SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/
Please respond to aspectj-users@xxxxxxxxxxx
Sent by:
aspectj-users-bounces@xxxxxxxxxxx
To:
aspectj-users@xxxxxxxxxxx
cc:
Subject:
[aspectj-users]
Intercepting web services... ;)
If i run this with aspectJ compiled classes, I am getting
the following message:
java.lang.reflect.InvocationTargetException
if compiled using normal java, it runs absolutely fine.
can anyone tell me what is it that i am doing wrong??
The codes are as given...
The webservice client code:
public class Client
{
public static void main(String [] args)
{
try {
String endpointURL = "http://localhost:8080/axis/services/MyService";
S tring textToSend = "Sunny";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(
new java.net.URL(endpointURL) );
call.setOperationName( new QName("http://example3.userguide.samples",
"serviceMethod") );
call.addParameter( "arg1",
XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING
);
String ret =
(String) call.invoke( new Object[] { textToSend } );
System.out.println("You
typed : " + ret);
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
The service code:
public class MyService
{
public String serviceMethod(String arg)
{
return arg;
}
}
The aspect code:
public aspect Cept {
before () : execution(public String serviceMethod(String))
{
System.out.println("print this");
}
}
Yahoo! Photos – Showcase holiday pictures in hardcover
Photo
Books. You design it and we’ll bind it!_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users