如何使用ejb3创建有状态的Web服务?

时间:2014-03-12 00:53:09

标签: web-services ejb jax-ws

这是我的网络服务...... 使用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端点找不到..任何想法?我需要保持我的客户状态

1 个答案:

答案 0 :(得分:2)

您不能使用@WebService注释注释有状态会话bean,它是无状态的only available