Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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";
            String 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!

Back to the top