1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
import test.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
...
try {
ORB orb = ORB.init( (String[])null, null);
String ior = ...
/////////////////////////////////////////////////////////////////////////
// Récupérer ici l'IOR de l'objet suivant l'un des 3 méthodes. //
// précédement décrites //
// Voir didacticiel. //
/////////////////////////////////////////////////////////////////////////
org.omg.CORBA.Object objref = orb.string_to_object(ior);
Hello hello = HelloHelper.narrow(objref);
hello.sayHello(); // Affiche "Hello world" sur le serveur.
System.out.println(hello.tellHello()); //Affiche "Hello world" sur le client.
}
catch (Throwable t) {
t.printStackTrace();
} |