users@glassfish.java.net

EJB3 interfaces with _at_Remote and _at_WebService annotations.

From: <glassfish_at_javadesktop.org>
Date: Sat, 01 Aug 2009 11:28:34 PDT

Hi,

I've been reading a bit about how to expose some of my stateless session beans as web services. In the book EJB3 in Action, the author says:

----------

[i]A careful look at the code reveals that the @WebService endpoint interface looks similar to the remote interface. You might be tempted to mark the same interface as both a web service and a remote interface, like this:[/i]

[code]
@WebService
@Remote
public interface PlaceBid {
  public Long addBid(String bidderId, Long itemId, Double bidPrice);
}
[/code]

[i]Unfortunately, although some vendors allow this as an extension, this is not part of the specification, and code that uses this particular attribute combination won't be portable.[/i]

----------

I've skimmed a few dozen examples online and a lot of them use both annotations in the interface. I can't find an explanation of how it works or the 'proper' way of doing things. Can anyone point me in the right direction or explain to me why you're not supposed to use both annotations in the same interface?
[Message sent by forum member 'jptech' (jptech)]

http://forums.java.net/jive/thread.jspa?messageID=358466