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.doGetBean(Abst
> ractBeanFactory.java:322) at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
> ctBeanFactory.java:190) at
> org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTa
> rgetSource.java:33) at
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.g
> etTarget(Cglib2AopProxy.java:653)[74:org.springframework.aop:3.0.5.RELEASE]
> at
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.i
> ntercept(Cglib2AopProxy.java:604)[74:org.springframework.aop:3.0.5.RELEASE]
> at
> com.ge.research.sadl.sadlserver.cxf.provider.SadlServiceProvider$$EnhancerBy
> CGLIB$$cb9694d2.getClassName(<generated>) at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)[:1.6.0_25]
>      at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )[:1.6.0_25] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .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(AbstractInv
> 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.SadlServiceProvider"
> > >
> > <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.ISadlS
> >> 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.SadlServiceProvide
> >> 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