Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Webservice and remote ejbs

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic