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
--
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com