Cherry
Cherry

Reputation: 33618

It is possible to use @Webservice annotation without @Stateless?

There is an example with web service usage. Is it possible to use only @Webservice annotation without @Stateless?

Upvotes: 2

Views: 322

Answers (2)

Steve C
Steve C

Reputation: 19445

Of course it is possible. However, it must be a class that is part of a web module.

See §5.4.3 Web App Module Packaging in "Web Services for Java EE, Version 1.3".

Upvotes: 1

Eduard
Eduard

Reputation: 3671

It is not possible straight away, but I am pretty sure that with some workaround (hack) you can do that. But is pointless.

As of Wikipedia: http://en.wikipedia.org/wiki/Web_service

"representations of Web resources using a uniform set of "stateless" operations"

A web service is "stateless" by definition.

If you want to have it with a state, then you will have to implement a call that will return a sessionId or some token that can be linked to a sessionId and after that to require all subsequent calls to pass also that sessionID. You can't rely on cookies for a webservice, because the client is not always a browser.

Upvotes: 0

Related Questions