I spoke last week to some people at the WS-Edge conference held in Boston, about (my favorite topic) Interop. One of the things that came up was the use of Java serialization as an interop tool. This is not news, we have shown before that it is possible to use Java serialization as a binary data format, when exchanging data between a .NET app and a Java app. The idea is, you take a common Java class that can serialize and de-serialize itself, compile it once with Javac.exe, and once with VJC.exe. The output stream of one can be de-serialized by the other.
The only demo I had of that was a pair of apps that communicate via MQSeries. I figured that was an obstacle for some people, so here is a pair of apps that communicate by reading and writing a common file. One is a Winforms/.NET app, the other a SWT/Java app. The C# project builds in Visual Studio, and the Java app builds in Eclipse 3.0.
get the source
shot of the winforms app, after just having saved (Serialized) a message:
shot of the Java/SWT app, after just having loaded that message:
As you can see, the UI in both apps gives an option to save the data as XML or in a binary stream . .NET includes integrated XML serialization capability, while Java does not. So for this example, the XML piece on the Java side is implemented by Apache XMLBeans, but you could use JAXB, or GLUE, or anything. XML Serialization is not required for Java binary serialization, of course. I included it for comparison purposes only.