6

Hypothetically, you have two products, one written in Java, the other in C#. You like the Java based backend (non-user visible portion), but would like to use the C# (WPF) frontend. What is the best way to go about interfacing them?

Note that the backend must be able to run on either a server or on the local machine and the frontend should be able to connect to either one.

My first thoughts were to use something like Ice, or maybe a webservice.

And Go!

Edit

Converting the code or running it in some variety of neutral VM (IKVM) is not an option.

Beardo
  • 1,542
  • 1
  • 14
  • 27

7 Answers7

2

Web services should be your default choice because there is so much work around interoperability in that space.

If you don't mind tight coupling, and must make performace based decisions, two solutions I have encountered are:

I'm sure there are others.

Michael Meadows
  • 27,796
  • 4
  • 47
  • 63
2

While Web Services (WS-*) might be the correct solution, getting stacks to interoperate can be kludgy.

There is much to be said for HTTP + (POX | JSON) and REST-ian architecture.

Larry OBrien
  • 8,484
  • 1
  • 41
  • 75
1

Expose a web service on the java backend and have the C# front end talk to the java web service. Look into WCF (windows communication foundation) it might make talking to a java web service alot easier.

Chris Marisic
  • 32,487
  • 24
  • 164
  • 258
1

You could use webservices.

Or you could use IVKM to embed the java code directly into a .NET assembly.

FlySwat
  • 172,459
  • 74
  • 246
  • 311
0

There are several methods for creating/obtaining interoperability between java and .net systems.

  • Web services
  • Visual J#
  • Java Native Interface (JNI)
  • BytecodeTranslation
  • Runtime Bridges

Web Services are most commonly used. Web services mostly use a SOAP-based communications mechanism that may be inherently slower than alternative binary communications mechanisms. Web services are also not well-suited for passing custom objects between Java and .NET as parameters and return values.

This article gives really good overview on what is what:

http://www.devx.com/interop/Article/19945

Erik Kaju
  • 3,147
  • 3
  • 19
  • 28
0

I've worked on the java back-end to a C# rich-client. They communicated via web-services alright. The only problem we really had was with inheritance hierarchies, which web-services WSDLs erase.

sblundy
  • 60,628
  • 22
  • 121
  • 123
0

I do believe there are some interoperability issues using Web Services across Java/.NET platforms. For instance there are some problems using Axis2 and .net together. In most cases workarounds exists.

I've heard some good comments about using REST-ian architecture though.