For the constructor joinpoint you want this signature:

execution(EndpointReference.new(..))

For the sendReceive you have the signature right but that will only apply
if you weave *into* the jar containing the implementation of sendReceive.
If you are weaving into the caller of sendReceive you need:

call(* sendReceive(..))
(And if using call() there, maybe you also want
call(EndpointReference.new(..)) for the constructor)

cheers,
Andy








On 9 January 2014 02:03, Shanmuga Priya R
<shanmugapriya1...@cse.ssn.edu.in>wrote:

> Hi,
>
>      I wanted to use aspectj during invocation of web service from other
> service. For that i wanted to know how to specify the jointpoint.
>
> *Web services code:*
>
>
> *import org.apache.axis2.AxisFault;import
> org.apache.axis2.addressing.EndpointReference;import
> org.apache.axis2.client.Options;import
> org.apache.axis2.client.ServiceClient; import
> org.apache.axiom.om.OMAbstractFactory;import
> org.apache.axiom.om.OMElement;import org.apache.axiom.om.OMFactory;import
> org.apache.axiom.om.OMNamespace; public class MiddleSimpleInterest{
> public static void main(String[] args) throws AxisFault    {
>  ServiceClient client = new ServiceClient();       Options opts = new
> Options();        opts.setTo(new
> EndpointReference("http://localhost:8088/axis2/services/SimpleIntJava
> <http://localhost:8088/axis2/services/SimpleIntJava>"));
>  opts.setAction("urn:findInterest");        client.setOptions(opts);
>  OMElement res = client.sendReceive(createPayLoad());
>  System.out.println(res);    }   private static OMElement createPayLoad()
>  {        OMFactory fac = OMAbstractFactory.getOMFactory();
> OMNamespace omNs = fac.createOMNamespace("http://simpleintjava
> <http://simpleintjava>", "ns");         OMElement method =
> fac.createOMElement("findInterest", omNs);        OMElement value =
> fac.createOMElement("p", omNs);        value.setText("1000");
> method.addChild(value);        return method;    }}*
>
> *Corresponding Aspectj code:*
> public aspect MiddlewareAspect
> {
> pointcut beforeaspect():execution(* *.sendReceive(..));
>
>         pointcut beforeexeaspect():execution(* EndpointReference(..));
> *        before():beforeaspect()        {
> System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
> System.out.println("====Before sendReceive=====");
> System.out.println("~~~~~~~~~~~~~~~~~~~~~~");         }*
>          before():beforeexeaspect()
>          {
>                System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
>                System.out.println("====Before *EndpointReference*=====");
>                System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
>          }
> }
>
> *Error:*
>
>       For the above aspectj code i got the exception "*Advice didn't
> match*".
>
>
>  How can i specify those 2 join points? Is it possible in aspectj?
>
> Thanks,
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to