Is an EJBObject used when dealing with a EJB endpoint interface?

Discussions

XML & Web services: Is an EJBObject used when dealing with a EJB endpoint interface?

  1. Is an EJBObject used when dealing with a EJB endpoint interface?

    Lets for argument sake assume there is a SLSB that acts as a Web Service EJB endpoint as well as the normal functionality of a SLSB.

    The SLSB, PurchaseOrder, defines 1 class and 3 interfaces.

    PurchaseOrder - Remote Interface
    PurchaseOrderBean - Bean Implementation
    PurchaseOrderHome - Home Interface
    PurchaseOrderWebServiceIF - EJB endpoint interface.

    So if a normal (non-web service) invocation is made, the client obtains a reference to the Remote interface, PurchaseOrder, in this case. The Remote interface is implemented by the EJBObject created by the J2EE container which delegates any method calls to the actual bean implementation.

    Right, so my question is, does an "invisble" EJBObject also implement an EJB endpoint interface, that delegates the invocation to the actual bean (to provide transactions, etc.) ? OR is does the bean actually implement the EJB endpoint interface, without any container generated objects, such as EJBObjects?

    Any references to any literature would be greatly appreciated.

    Thanks

    Zak
  2. The bean class does not have to implement the EJB endpoint interface. This is consistent with the EJB principal of not implementing interfaces. Having said that, it does no harm to implement the endpoint interface. This is because the endpoint interface only defines business methods, it does not inherit component interface methods.

    In any case, the bean class must implement methods which match those of the endpoint interface exactly, with one exception. It is forbidden for any endpoint bean method to declare java.rmi.RemoteException.

    The EJB endpoint bean can be a new bean or an existing stateless session bean which is deployed to double as an EJB endpoint bean. Either way, the bean will have a compnent interface and an EJB object in the usual way.