簡體   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