I want to pass a Java Object, say an Image or an Image Icon, using CORBA. How I write the IDL for it and how do I write the server code in Java for it?

Frank Mitchell

You could serialize the object into a byte array; your IDL methods can pass it around as "sequence<octet>". However, you lose the language-independence of CORBA, and shipping around huge byte arrays is probably not efficient. Other possible solutions:

  • If it's just an image, you can serialize the image data (possibly using JPEG or another compression scheme). This gives you language/platform independence again.
  • CORBA supports a spec called Objects-By-Value, which allows you to define an object in IDL, and pass it by serializing it. However, this only works with objects you write, and not all CORBA implementations support it.
  • Depending on your application, you might also want to ship the serialized data using another protocol (like HTTP or FTP), and pass around a URL to the data. This would require setting up a web server or servlet to provide the data.