Saturday, January 31, 2009

Java - .Net Interoperability

VCommentJava - .Net Interoperability
A study on the various interoperability options available for Java and .Net. Putting it in easy wordings. For heaven's sake, do consult me if you are new to this and looking for one such solution.

Some of the options available are:

Using Web Services (SOAP based, REST based)
Web Services are services which use XML based SOAP for communication. This is an open standard. Most of the companies are adopting this approach.

Advantages:
  • Ease of use.
  • Can integrate anything with anything. [Open Standard]
Disadvantages:
  • Serializing the data to be transferred to XML and de-serializing them back [Consumes more time].
  • Transferring XML data over wire is costly than sending the raw data.
If we need high performance systems, this is not the best option.

Binary Interoperability
Binary interoperability methods take objects from one platform, serialize them into a binary stream, send them across the network and then de-serialize the same data on the other platform. Because both parties agree on the binary format to use, the serialization ensures that the binary data is successfully mapped to local data types for each platform. .NET Remoting is a protocol available for this (more like a specification). There are lots of third party implementations on top of this. Famous being, JNBridge Pro

Advantages:
  • Faster communication.
  • Shared access of objects across platforms.
Disadvantages:
  • All tools are costly
  • .NET Remoting is not a recognized standard
  • Tight coupling between client and server
CORBA based interoperability
Binary interoperability using the standards of CORBA (Common Object Request Broker Architecture). Java supports RMI using CORBA based protocol IIOP. But, .Net doesn’t support CORBA out of the box. Found a tool called IIOP.Net which does the folowing:
  1. Using Java RMI support, we can create IDL (Interface Definition Language), a common CORBA specific type definition.
  2. Create CLS (.Net Specific assemblies) from these IDL files using IIOP.Net's IDLToCLSCompiler. It will generate .dll file
  3. Add a reference to that dll file from .Net and access those classes as proxy.
  4. Use IIOPChannel to communicate with the Java remote objects.
Advantages: Same as above.

Disadvantages:
  • CORBA way would be maintenance nightmare
  • Can't rely fully on the underlying channels
  • System gets complex
References
DevX article on interoperability options
IIOP.Net
JNBridge Pro

--Varun