Dan, Firstthing i have to say, i am new to CXF and WS Concepts.
Can you please let me know what do you mean by publishing. (may be very small thing i am missing here...) The code which i posted is the one which i am using, and i am deploying it in Weblogic. Raj On Thu, Mar 14, 2013 at 2:35 AM, Daniel Kulp <[email protected]> wrote: > > On Mar 13, 2013, at 2:35 PM, Rajagopal Chowdary Yendluri < > [email protected]> wrote: > > >> Thanks Dan, > >> > >> But if you look at UserServiceImpl class, it is annotated with > @Service, > >> so it participates in context component scan and spring creates this > bean, > >> right? > > Well, spring may create an instance of it, but that may not be the bean > that is being passed into CXF to actually publish. How are you publishing > the endpoint? That's the important thing to look at. > > Dan > > > > > >> > >> Let me know if i am not making you clear on this. > >> > >> FYI.. i am using SOAPUI client to invoke this webservice > (UserServiceImpl > >> ) for testing. > >> > >> Raj > >> > >> > >> On Wed, Mar 13, 2013 at 11:25 PM, Daniel Kulp <[email protected]> wrote: > >> > >>> > >>> > >>> How are you creating the UserServiceImpl instance? AKA: how are you > >>> publishing the endpoint? > >>> > >>> For the aspects to work, spring has to create the bean. If you just > >>> pass a classname into CXF, we'll just do a "newInstance" on it and get > a > >>> basic object. Thus, you would need to have spring create it (<bean > >>> class="…" id="name"/>) and then reference that spring created bean. > >>> > >>> Hope that helps. > >>> > >>> Dan > >>> > >>> > >>> > >>> On Mar 13, 2013, at 11:50 AM, Rajagopal Chowdary Yendluri < > >>> [email protected]> wrote: > >>> > >>>> Hi, > >>>> > >>>> > >>>> Here is the scenario i am trying. > >>>> > >>>> 1. when an exception thrown from a web service i want to invoke an > >>> aspect > >>>> which is sending a mail to a mailing list. > >>>> > >>>> Here is the steps which i tried. > >>>> > >>>> 1. Added AspectJ support in applicaiton context by adding the > following > >>>> line. > >>>> > >>>> *<aop:aspectj-autoproxy/>* > >>>> > >>>> 2. Written a new Aspect as following: > >>>> > >>>> > >>>> @Aspect > >>>> @Component > >>>> public class ExceptionMailer{ > >>>> > >>>> @AfterThrowing(pointcut="execution(* com.mycompany.*..impl.*.*(..))", > >>>> throwing ="ex") > >>>> public void sendExceptionMail(JoinPoint joinPoint) { > >>>> System.out.println(" Sending Email .....................again "); > >>>> } > >>>> } > >>>> > >>>> > >>>> 3. Here is my WebService class. > >>>> > >>>> package com.mycompany.common.services.impl; > >>>> @WebService(endpointInterface = > >>>> "com.mycompnay.common.services.UserService",serviceName="UserDetails") > >>>> @Service > >>>> public class UserServiceImpl implements UserService { > >>>> > >>>> public List<User> getUserDetails(String userId) throwsException { > >>>> > >>>> try { > >>>> throw new Exception("Msg Exception ...."); > >>>> } catch (Exception e) { > >>>> throw new Exception("xcepiton"); > >>>> } > >>>> } > >>>> @PostConstruct > >>>> public void init() { > >>>> > >>> > SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); > >>>> } > >>>> } > >>>> > >>>> When i create a seperate project with the same pointcout and with the > >>> same > >>>> package structure it is working good, but not with CXF. > >>>> > >>>> Is there any way / we need to tell CXF, that i am using AspectJ AOP. > >>>> It is not throwing any exception, it is silently ignoring the Aspect. > >>>> > >>>> > >>>> -- > >>>> Regards, > >>>> Rajagopal Yendluri(Raj) > >>> > >>> -- > >>> Daniel Kulp > >>> [email protected] - http://dankulp.com/blog > >>> Talend Community Coder - http://coders.talend.com > >>> > >>> > >> > >> > >> -- > >> Regards, > >> Rajagopal Yendluri(Raj) > >> > > > > > > > > -- > > Regards, > > Rajagopal Yendluri(Raj) > > -- > Daniel Kulp > [email protected] - http://dankulp.com/blog > Talend Community Coder - http://coders.talend.com > > -- Regards, Rajagopal Yendluri(Raj)
