繁体   English   中英

如何使用 ejb3 制作有状态的 Web 服务?

[英]How to make an stateful web service with ejb3?

这是我的网络服务...使用 EJB3 + Jboss AS7

@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());
    }

}

但是在我的 jboss 7 端点中没有找到......知道吗? 我需要保持我的客户的状态

您不能使用 @WebService 注释来注释有状态会话 bean,它仅可用于无状态。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM