| Author |
Webservice and remote ejbs
|
Bob Randall
Greenhorn
Joined: Jun 01, 2006
Posts: 5
|
|
I have a requirement to call a remote ejb y in a different ear through ejb x in another ear using webservices on weblogic. I have some of the steps for using ejb y as a remote service create the stateless bean y remote interface, bean, home For exposing the bean y as Web service endpoint interface Do I need an entry <service-endpoint></service-endpoint> in ejb-jar.xml. Use weblogic servicegen ant task to generate web-services.xml and put it in ear file specify ejb jar serviceName serviceURI targetNamespace The webservices.xml looks like <weblogic-webservices xmlns="http://www.bea.com/ns/weblogic/90"> <webservice-description> <webservice-description-name>yService</webservice-description-name> <port-component> <port-component-name>yServicePort</port-component-name> <service-endpoint-address> <webservice-contextpath>/yService</webservice-contextpath> <webservice-serviceuri>/yService</webservice-serviceuri> </service-endpoint-address> </port-component> </webservice-description> </weblogic-webservices> My question is that from x bean can I use JAX-RPC to access y bean and if yes can I have some code sample.
|
 |
Peer Reynders
Bartender
Joined: Aug 19, 2005
Posts: 2906
|
|
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.
|
"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
|
 |
 |
|
|
subject: Webservice and remote ejbs
|
|
|