Scott,

working on the webservice client programing model, I need to bind a 
javax.xml.rpc.Service to JNDI. In the test below I bind it to the global JNDI 
namespace. However, when I lookup the service I get null without a NamingException.

The code below first tests if the service object can be serialized without JNDI 
involvement, then it tests if bind/lookup of a trival string object works. Finally the 
actual service is bound (I can see it in jmx-console) and then looked up again. The 
last assertion fails.

Any idea?

cheers
-thomas

----------------------

      String SERVICE_JNDI_NAME = "service/HelloWsService1";

      Service service = new org.apache.axis.client.Service();

      // first try to marshal/unmarshal the service without JNDI
      ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(service);
      oos.close();
      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bais);
      service = (Service)ois.readObject();
      assertNotNull("cannot serialize service", service);

      // test JNDI lookup with a trivial String
      InitialContext iniCtx = getInitialContext();
      Util.bind(iniCtx, SERVICE_JNDI_NAME, "Test JNDI");
      assertEquals("Test JNDI", iniCtx.lookup(SERVICE_JNDI_NAME));
      Util.unbind(iniCtx, SERVICE_JNDI_NAME);

      service = new org.apache.axis.client.Service();

      // now do the actual binding and lookup
      Util.bind(iniCtx, SERVICE_JNDI_NAME, service);
      service = (Service)iniCtx.lookup(SERVICE_JNDI_NAME);
      assertNotNull ("cannot lookup service", service);
      Util.unbind(iniCtx, SERVICE_JNDI_NAME);







-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to