users@glassfish.java.net

how do i get a jndi reference to a web service -- want to use lookup()

From: <glassfish_at_javadesktop.org>
Date: Sun, 22 Jun 2008 14:57:13 PDT

i can do:

InitialContext ctx=new InitialContext(); Service = ctx.lookup("service/HelloWorld");
from within an app-client, or a web client;

how do i do the same thing from a PO.Java app ?

i can reference an ejb from a POJava app like this:
Context ctx = new InitialContext();
Object objRef = ctx.lookup("ejb/CartBean");
CartRemoteHome home = (CartRemoteHome) PortableRemoteObject.narrow(objRef, CartRemoteHome.class) -- from a PO Java app.

the sun-ejb-jar.xml for CartSB has:

<sun-ejb-jar>
  <enterprise-beans>
    <ejb>
      <ejb-name>CartBean</ejb-name>
      <jndi-name>ejb/CartBean</jndi-name>
    </ejb>
  </enterprise-beans>
</sun-ejb-jar>

which i think is what causes the "ejb/CartBean" to exist in the JNDI namespace.

but i am not aware of a way to do similar thing with sun-web.xml/web.xml ;

the "service/HelloService" JNDI name in jndi context appears to come from the application-client.xml via:

<service-ref>
    <service-ref-name>service/HelloWorld</service-ref-name>
    ...
  </service-ref>

thanks
[Message sent by forum member 'emiddio' (emiddio)]

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