tags:

views:

116

answers:

3

I need to call an API that's all in java from an existing .NET codebase. What's the best approach here? Writing a webservice in java that basically just forwards the calls to the API - or going with something like JNI4NET?

+1  A: 

That depends. If it is a desktop application, you can use JNI. But for a web based application you have to use the web services.

RaviG
The usecase is that I'm going to be calling into the java api from a WAS-hosted WCF service. Does that preclude the JNI approach?
Ciddan
You can use JNI in this case.
RaviG
A: 

If its a web based application you can also look at using an RMI proxy object on the java server side and IIOP.NET on the .NET client side.

It will be orders of magnitude faster than web services.

Justin
A: 

You can use jni4net, which is a JNI bridge between .Net and Java. (Props to Darin Dimitrov for providing this info in an answer to another question.)

T.J. Crowder
I wish I could give Darin Dimitrov the answer, but I'll have to give it to you instead :) I ended up going with IKVM for the task, and after alot of work I got it working like a charm!
Ciddan
@Ciddan: Yeah. I even posted a link to this question in the one I lifted the info from, but he didn't bite. :-) Have to settle for us both upvoting him, eh?
T.J. Crowder