On Wednesday, September 07, 2011 2:02:56 PM Barry Hathaway wrote:
> Thanks Dan, I'll post a similar question on the FUSE SMX list.

Probably better to just post to the us...@servicemix.apache.org list.  

> I understand your comment about the need to have a
> RequestContextListener when using AOP.
> Now, if instead of using AOP, if I switch to using a @FactoryType(value
> = FactoryType.Type.Spring, args="sadlServiceProvider")
> does that change the situation?

Probalby not as that would still require the Spring listener thing.


You can TRY:


@FactoryType(value  = FactoryType.Type.Session)

on the service bean itself, but if you have anything that you expect Spring to 
inject in, it likely won't.

Dan



> Thanks.
> 
> Barry
> 
> On 9/6/2011 3:39 PM, Daniel Kulp wrote:
> > On Tuesday, September 06, 2011 2:53:47 PM Barry Hathaway wrote:
> >> Taking Dan's suggestion I got this to work in a CXF/Tomcat
> >> environment.
> >> Now I'm trying to migrate this service to a ServiceMix environment.
> >> After building all the bundles, installing them, and running a client
> >> to
> >> access the service
> > 
> > Hmm...   in order for the Spring scoped proxy to work, the Spring
> > RequestContextListener thing needs to be registered on the servlet
> > context. I have no idea (I hightly doubt) if servicemix does that.    
> > You may need to switch to the CXF specific factories if using SMX.   
> > That said, I'm not even sure if how SMX sets up Jetty if they have
> > sessions turned on at all. That may be more of a question for that
> > list.
> > 
> > Dan
> > 
> >> I get:
> >> 
> >> org.apache.cxf.interceptor.Fault: No Scope registered for scope
> >> 'session' ....
> >> Caused by: java.lang.IllegalStateException: No Scope registered for
> >> scope 'session'
> >> 
> >>       at
> >> 
> >> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBea
> >> n(Abst ractBeanFactory.java:322) at
> >> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
> >> Abstra ctBeanFactory.java:190) at
> >> org.springframework.aop.target.SimpleBeanTargetSource.getTarget(Simple
> >> BeanTa rgetSource.java:33) at
> >> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterce
> >> ptor.g
> >> etTarget(Cglib2AopProxy.java:653)[74:org.springframework.aop:3.0.5.RE
> >> LEASE] at
> >> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterce
> >> ptor.i
> >> ntercept(Cglib2AopProxy.java:604)[74:org.springframework.aop:3.0.5.RE
> >> LEASE] at
> >> com.ge.research.sadl.sadlserver.cxf.provider.SadlServiceProvider$$Enha
> >> ncerBy CGLIB$$cb9694d2.getClassName(<generated>) at
> >> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >> Method)[:1.6.0_25]
> >> 
> >>       at
> >> 
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> >> ava:39 )[:1.6.0_25] at
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> >> orImpl .java:25)[:1.6.0_25] at
> >> java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_25] at
> >> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(Abstr
> >> actInv oker.java:173)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43] at
> >> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.
> >> java:8 9)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43] ... 42 more
> >> 
> >> Any ideas?
> >> Thanks.
> >> 
> >> Barry Hathaway
> >> 
> >> On 8/15/2011 4:59 PM, Daniel Kulp wrote:
> >>> The EASIEST way to do this is to no stick a @FactoryType thing on
> >>> there
> >>> at all and just do:
> >>> 
> >>> <bean id="sadlServiceProvider"
> >>> scope="session"
> >>> class="com.ge.research.sadl.sadlserver.cxf.provider.SadlServiceProvi
> >>> der" <aop:scoped-proxy/>
> >>> <property name="serviceNameMap">
> >>> <map>
> >>> 
> >>>                   .........
> >>> 
> >>> </map>
> >>> </property>
> >>> </bean>
> >>> 
> >>> <jaxws:endpoint id="SadlService" implementor="#sadlServiceProvider"
> >>> address="/SadlService" />
> >>> 
> >>> 
> >>> 
> >>> However, you could also do it without the AOP if you use the
> >>> @FactoryType(value = FactoryType.Type.Spring,
> >>> args="sadlServiceProvider")
> >>> 
> >>> 
> >>> Dan
> >>> 
> >>> On Friday, August 12, 2011 8:01:00 PM Barry Hathaway wrote:
> >>>> I'm trying to create a web service that will maintain states with
> >>>> a
> >>>> session. I've defined the service as:
> >>>> 
> >>>> @WebService(serviceName="SadlService",name="SadlService",
> >>>> targetNamespace="http://sadlserver.sadl.research.ge.com";,
> >>>> endpointInterface="com.ge.research.sadl.sadlserver.cxf.provider.IS
> >>>> adlS
> >>>> ervice Provider") @FactoryType(value = FactoryType.Type.Session)
> >>>> public class SadlServiceProvider implements ISadlServiceProvider {
> >>>> 
> >>>>        private Logger logger =
> >>>>        LoggerFactory.getLogger(getClass());
> >>>>        ISadlServer server = null;
> >>>>        private Map<String,String[]>   serviceNameMap =
> >>>>        null;
> >>>>        
> >>>>        @WebMethod(exclude=true)
> >>>>        public Map<String,String[]>   getServiceNameMap() {
> >>>>        
> >>>>            return serviceNameMap;
> >>>>        
> >>>>        }
> >>>>        
> >>>>        @WebMethod(exclude=true)
> >>>>        public void setServiceNameMap(Map<String,String[]>
> >>>>        serviceNameMap) {>>
> >>>>        
> >>>>            this.serviceNameMap = serviceNameMap;
> >>>>        
> >>>>        }
> >>>>        
> >>>>        public SadlServiceProvider() {
> >>>>        
> >>>>            logger.debug("constructor called");
> >>>>            this.server = new SadlServerImpl();
> >>>>            server.setServiceNameMap(serviceNameMap);
> >>>>        
> >>>>        }
> >>>> 
> >>>> In my beans.xml file I have defined the bean with the
> >>>> serviceNameMap
> >>>> property:
> >>>> 
> >>>> <bean id="sadlServiceProvider"
> >>>> class="com.ge.research.sadl.sadlserver.cxf.provider.SadlServicePro
> >>>> vide
> >>>> r">  <property name="serviceNameMap">
> >>>> <map>
> >>>> 
> >>>>                   .........
> >>>> 
> >>>> </map>
> >>>> </property>
> >>>> </bean>
> >>>> 
> >>>> <jaxws:endpoint id="SadlService"
> >>>> implementor="#sadlServiceProvider"
> >>>> address="/SadlService" />
> >>>> 
> >>>> When the bean is first created (at the time the service is
> >>>> started)
> >>>> the
> >>>> setServiceNameMap method does
> >>>> get called and sets the map to the values defined in beans.xml.
> >>>> The
> >>>> problem is when I invoke another method
> >>>> on the service (via SoadUI) a new session gets created, the
> >>>> SadlServiceProvider constructor gets called, but
> >>>> the setServiceNameMap method does not get called.  So it appears
> >>>> that
> >>>> the a new bean is created by the
> >>>> factory; however, not in the same manner as initially done by
> >>>> Spring.
> >>>> 
> >>>> Any ideas how to do this?
> >>>> Thanks.
> >>>> 
> >>>> Barry Hathaway
-- 
Daniel Kulp
dk...@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to