Originally posted by Bob Randall: Do I need an entry <service-endpoint></service-endpoint> in ejb-jar.xml.
y -> service provider
x -> service consumer
You will need a <service-endpoint> entry in the service provider ejb-jar.xml. The interface specified there must match the one listed in the webservices.xml <service-endpoint-interface> entry.
The webservices.xml <port-component> entry is also supposed to contain a <service-endpoint-interface> entry which specifies the same interface listed in the <service-endpoint> entry in the ejb-jar.xml. Furthermore you need an <service-impl-bean> entry which contains an <ejb-link> to the implementing ejb.
(service provider) webservices.xml excerpt
(service provider) ejb-jar.xml excerpt
(service consumer) ejb-jar.xml excerpt
Originally posted by Bob Randall: My question is that from x bean can I use JAX-RPC to access y bean
Yes - however I suspect not in the manner that you are hoping. The J2EE 1.4 specification only guarantees that you can expose an SLSB as a web service and it guarantees that an EJB can access a web service. It does not guarantee that the EJB security and transaction semantics are maintained when an EJB accesses another EJB over a web services interface.
J2EE 1.4 does not provide for the propagation of EJB security and transactions over a web services connection.
Theoretically a vendor extension could propagate transactions through the use of WS-T ((Web services transactions)) and security information in SOAP headers or the HTTP session. In most cases however the service provider EJB simply manages its own transactions and its methods are simply exposed with <unchecked/>. It is possible to write your own JAX-RPC server and client side handlers so that you can perform your own client authentication before letting the call go through.
From the perspective of the service consumer EJB calling an EJB-based endpoint is no different than calling a servlet-based endpoint.