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
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(AbstractBeanFactory.java:322) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:33) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.getTarget(Cglib2AopProxy.java:653)[74:org.springframework.aop:3.0.5.RELEASE] at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:604)[74:org.springframework.aop:3.0.5.RELEASE] at com.ge.research.sadl.sadlserver.cxf.provider.SadlServiceProvider$$EnhancerByCGLIB$$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(AbstractInvoker.java:173)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43] at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)[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.ISadlService
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.SadlServiceProvider">
<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

Reply via email to