University of Cincinnati logo and link  
Making the Client, Calling a Remote Method
 
  UC ingotThe client is only slightly different in Web Services than it was in RMI.
    • In RMI, we called Naming.lookup with a String that represented the server object with which we wanted to communicate.  We casted the return object to the interface type that the server object implemented.
    • In Web Services, we're provided with an Impl object, created by the mapping program.  
      • This is a factory class that has a method to create a stub to communicate with the Web Service on the server.  
      • This stub implements the same interface as the Web Service on the server.  
      • In other words....


      chat = (Chat)Naming.lookup("rmi://localhost/ChatImpl"); 

      Looks more like:

      Chat chat = new ChatServiceImpl().getChat();
       

    • Starting the client is the same as RMI as well.  You simply start the client as you would any other Java program.
Example: Chat as a Web Service
JAXR: The Java API for XML Registries