5 Replies Latest reply on Jun 12, 2006 12:03 AM by Thomas Diesler

    how to invoke a client to jsr181-pojo web service?

    Adam Newbie

      Hello again

      A have successfully deployed jsr181-pojo web service as web application (war) and a client application w jar file. My question is - how to write a (real) client which would invoke web service client (jar) deployed on jboss? Some example code will be very helpful :) I have tried this code:

      public static void main(String[] args) throws Exception{
      new ClientTest().testTrivialAccess();


      public void testTrivialAccess() throws Exception
      InitialContext iniCtx = getInitialContext();
      Service service = (Service)iniCtx.lookup("java:comp/env/service/TestService");
      JSEBean01 port = (JSEBean01)service.getPort(JSEBean01.class);
      String person = "Kermit";
      String product = "Ferrari";
      String status = port.echo(person);


      protected InitialContext getInitialContext() throws NamingException
      InitialContext iniCtx = new InitialContext();
      Hashtable env = iniCtx.getEnvironment();
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
      env.put("j2ee.clientName", "jbossws-client");
      return new InitialContext(env);

      but i see only stack trace of exception...
      I wish the code would be simpler - without lines with env.put.... but i think it's not possible...
      Help me!

      Thanks in advance,