简体   繁体   English

从.NET调用Java API - 最好的方法

[英]Calling a Java API from .NET - best approach

I need to call an API that's all in java from an existing .NET codebase. 我需要从现有的.NET代码库中调用java中的所有API。 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 ? 在java中编写一个web服务,基本上只是将调用转发给API - 或者像JNI4NET这样的东西

You can use jni4net , which is a JNI bridge between .Net and Java. 您可以使用jni4net ,它是.Net和Java之间的JNI桥。 (Props to Darin Dimitrov for providing this info in an answer to another question.) (向Darin Dimitrov道具提供此信息以回答另一个问题。)

That depends. 那要看。 If it is a desktop application, you can use JNI. 如果是桌面应用程序,则可以使用JNI。 But for a web based application you have to use the web services. 但对于基于Web的应用程序,您必须使用Web服务。

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. 如果它是基于Web的应用程序,您还可以查看在Java服务器端使用RMI代理对象和在.NET客户端使用IIOP.NET

It will be orders of magnitude faster than web services. 它将比Web服务快几个数量级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM