Can someone show me a simple example of how to get an object reference to an object built using Orbix 3.0.1 C++.

Michael Szlapa

The most realiable way to obtain the initial object reference is to use IOR file.This works with any orb. Your CORBA server object should execute object_to_string and then save this string to the file.

Client program should:

LineNumberReader input = new LineNumberReader( new FileReader(fileName) );
String ior = input.readLine();
Object obj = org.omg.CORBA.ORB.string_to_object(ior)

Then cast the object to your type:

YourClass yourObject = YourClassHelper.narrow(obj);

You will get YourClassHelper by compiling IDL using the compiler supplied with your ORB.

If you really want to use Iona ORB you can try :
YourClass = YourClassHelper.bind(":" + servername, hostname);<p>

when you compile your idl using the Iona compiler the Helper class should have the bind method. Please note however that there are problems with Iona ORB 3.0 and Java 2. See also: http://java.sun.com/products/jdk/1.2/docs/guide/idl/jidlInitialization.html

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact