KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > examples > mbeans > iiop > IIOPClient


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8 package mx4j.examples.mbeans.iiop;
9
10 import javax.naming.InitialContext JavaDoc;
11 import javax.rmi.PortableRemoteObject JavaDoc;
12
13 /**
14  * This example connects to an RMI over IIOP server and invoke the services it exposes,
15  * in this simple example it just calls {@link Hello#sayHello}.
16  *
17  * @version $Revision: 1.4 $
18  */

19 public class IIOPClient
20 {
21    public static void main(String JavaDoc[] args) throws Exception JavaDoc
22    {
23       InitialContext JavaDoc ctx = new InitialContext JavaDoc();
24       Hello remoteInterface = (Hello)PortableRemoteObject.narrow(ctx.lookup(Hello.IIOP_JNDI_NAME), Hello.class);
25       remoteInterface.sayHello("from the MX4J Team");
26    }
27 }
28
Popular Tags