简体   繁体   中英

How to make an stateful web service with ejb3?

This is my webservice... With 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());
    }

}

but in my jboss 7 endpoint is not found.. any idea? I need keep state of my client

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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