I went to a few sessions at JavaOne 2006. One was called Best
Practices for Interoperability Between Java Technology and .NET
Server Applications - it was put on by Ray Lai, an independent,
and Marina Fisher of Sun, along with Larry
Moroney of MainSoft. This was a pretty
popular session, I would guess somewhere between 500 and 750
people were in attendance. Apparently it's a topic of interest!
About half of the session covered options for
interconnecting Java apps with .NET, including webservices and
other approaches. The second half wasn't really interop; instead it covered
Mainsoft's Mainwin product.
In the section covering webservices, Ray Lai gave some very
good advice: start with schema first, confine your interfaces
to a simple subset of XML Schema. Test often. Look out for edge
cases. All good stuff. By the way, that applies regardless of the endpoints: Java, .NET, PHP, C++, or anything else.
Marina Fisher talked about other possibilities for interop.
Message queues, for example - a good interop mechanism. She did
not mention that MSMQ can be an effective bridge between Java
and .NET. She implied that it would take a JMS bridge and some
other magic, when it's actually much simpler than that, as I
have previously described. The simple approach also works with
IBM MQseries (and I sound like I am repeating myself, but yes, I
have described that previously, too)
But for the most part, the interop portion of the session
was good, solid, fundamental advice.
Then we moved to the Mainwin portion of the session. MainWin
apparently allows people to develop in ASP.NET apps in Visual
Studio, then run the result on a J2EE-compliant app server.
This isn't interop per-se, or at least I don't think of it as
interop. It is more like cross-compiling or cross-targeting,
rather than inter-system communication. So I felt it was a
little out of place in this session. But it wasn't my session
and they didn't ask me, did they?
Mainsoft, I gather, is able to pull off this magic by
translating MSIL to Java bytecode. That takes care of the
ASP.NET app itself, but what about the underlying ASP.NET
runtime? Well, apparently Mainsoft also ran the
MSIL-to-bytecode translator on the .NET runtime from project
Mono. So the app, plus the underlying ASP.NET runtime, are all
compiled into Java bytecode. The result just works, so they
say; it just runs on a J2EE container. (I didn't try this)
I suppose there would be a few problems, for example, if you
tried to reference a class that Mono does not implement, or if you
tried to reference a 3rd-party assembly from within the ASP.NET
app - let's say you wanted to connect to IBM MQSeries from
within the app via the IBM MQ Classes for .NET. I don't think
this assembly is available (in translated form) on the Mainsoft
runtime. Not sure, though. I'm just guessing.
Also, I don't know if Mono has kept current with ASP.NET 2.0,
including the membership stuff, and the other providers.
One of the first
questions the audience asked was, "what about licensing - are
there license implications if you run ASP.NET on J2EE on Linux,
for example?" The answer from Mr Moroney of Mainsoft was: "No. No
license is required."
Needless to say, this was a surprising answer. Microsoft
considers .NET to be its intellectual property. We've invested
considerable effort building .NET, including ASP.NET. Part of
.NET was standardized with ISO
- that part includes the C# language as
well as a subset of the CLR and the .NET base class
library. Part of .NET was not submitted to ECMA or ISO.
Mono replicates the stuff that is standardized, but goes
further by also replicating the parts of .NET that are not
standardized, and adding other pieces. The second category of
stuff (parts of .NET that are not standardized) are Microsoft's
intellectual property. For someone from Mainsoft to say "there
are no license implications" ignores that fact. Even the Mono
say that. I don't know of an agreement between Mainsoft and
Microsoft on the license of this particular technology. Nor do I
know of any agreement between Microsoft and Novell (owner of the
Mono project) on same.
I am not a lawyer, but "no problem, dude!" seems like too
quick an answer to me. I pointed that out in the room, when I
got a chance to speak.
I also did not agree with the spin on webservices from
Mainsoft. Essentially it was, "Did you see all those
interop pitfalls Ray Lai pointed out? Use Mainwin and get
interop, while avoiding that stuff." I am paraphrasing, but that
was the honest gist of it.
That seems like overselling to me. My position: Web services works, and
works well. This approach solves lots of problems today, and it
is the main area of interop investment by Sun, Microsoft, IBM,
and many other companies. It works today, and it's mostly
pretty easy, and it's just going to get better. The correct
message is: You should have exceptional conditions to do
something other than webservices for interop today.
And ...re-hosting ASP.NET on a J2EE container, aside from going into unexplored IP territory, isn't really interop anyway.