Web services 如何使用ejb3创建有状态web服务?
这是我的网络服务。。。 使用EJB3+jbossas7Web services 如何使用ejb3创建有状态web服务?,web-services,ejb,jax-ws,Web Services,Ejb,Jax Ws,这是我的网络服务。。。 使用EJB3+jbossas7 @Stateful @WebService(serviceName = "teste") public class TesteWSImpl implements TesteWS { private List<String> strings; public TesteWSImpl() { strings = new ArrayList<String>(); } @W
@Stateful
@WebService(serviceName = "teste")
public class TesteWSImpl implements TesteWS {
private List<String> strings;
public TesteWSImpl() {
strings = new ArrayList<String>();
}
@WebMethod
@Override
public List<String> add(String string) {
strings.add(string);
return strings;
}
@PostConstruct
private void init() {
System.out.println("INIT WEB SERVICE. "
+ getClass().getCanonicalName());
}
@PreDestroy
public void destroy() {
System.out.println("DESTROY WEB SERVICE. "
+ getClass().getCanonicalName());
}
}
@Stateful
@WebService(serviceName=“teste”)
公共类TesteWSImpl实现TesteWS{
私有列表字符串;
公共测试程序impl(){
strings=newarraylist();
}
@网络方法
@凌驾
公共列表添加(字符串){
字符串。添加(字符串);
返回字符串;
}
@施工后
私有void init(){
System.out.println(“初始化WEB服务。”
+getClass().getCanonicalName());
}
@发情前期
公共空间销毁(){
System.out.println(“销毁WEB服务。”
+getClass().getCanonicalName());
}
}
但是在我的JBoss7中找不到端点。。有什么想法吗?我需要保留客户端的状态您不能使用@WebService注释对有状态会话bean进行注释,它是无状态的。在客户端保留状态是一个选项吗?(例如,像一个令牌,这样您就知道您的身份已经过验证)