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.ISadlServiceProvider")
@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