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?
假设有两种产品,一种是用Java编写的,另一种是用C#编写的。您喜欢基于Java的后端(非用户可见部分),但是想使用C#(WPF)前端。连接它们的最佳方法是什么?
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.
我的第一个想法是使用类似Ice的东西,或者也许是web服务。
And Go!
Edit
Converting the code or running it in some variety of neutral VM (IKVM) is not an option.
转换代码或在各种中性VM(IKVM)中运行代码不是一种选择。
7 个解决方案
#1
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.
在java后端公开Web服务,让C#前端与java Web服务对话。查看WCF(Windows通信基础)它可能使得与Java Web服务的谈话更容易。
#2
2
Web services should be your default choice because there is so much work around interoperability in that space.
Web服务应该是您的默认选择,因为在该空间中有很多关于互操作性的工作。
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.
我确定还有其他人。
#3
2
While Web Services (WS-*) might be the correct solution, getting stacks to interoperate can be kludgy.
虽然Web服务(WS- *)可能是正确的解决方案,但让堆栈进行互操作可能会很糟糕。
There is much to be said for HTTP + (POX | JSON) and REST-ian architecture.
HTTP +(POX | JSON)和REST-ian架构有很多要说的。
#4
0
You could use webservices.
你可以使用webservices。
Or you could use IVKM to embed the java code directly into a .NET assembly.
或者您可以使用IVKM将java代码直接嵌入到.NET程序集中。
#5
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.
我曾经在java后端工作过C#rich-client。他们通过网络服务进行沟通。我们真正遇到的唯一问题是继承层次结构,即Web服务WSDL擦除。
#6
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.
我相信在Java / .NET平台上使用Web服务存在一些互操作性问题。例如,一起使用Axis2和.net存在一些问题。在大多数情况下,存在变通方法。
I've heard some good comments about using REST-ian architecture though.
我听说过有关使用REST-ian架构的一些好评。
#7
0
There are several methods for creating/obtaining interoperability between java and .net systems.
有几种方法可用于创建/获取java和.net系统之间的互操作性。
- Web services
- Visual J#
- Java Native Interface (JNI)
- BytecodeTranslation
- Runtime Bridges
Java本机接口(JNI)
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.
Web服务是最常用的。 Web服务主要使用基于SOAP的通信机制,这种机制本身可能比其他二进制通信机制慢。 Web服务也不适合在Java和.NET之间传递自定义对象作为参数和返回值。
This article gives really good overview on what is what:
本文非常清楚地概述了什么:
#1
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.
在java后端公开Web服务,让C#前端与java Web服务对话。查看WCF(Windows通信基础)它可能使得与Java Web服务的谈话更容易。
#2
2
Web services should be your default choice because there is so much work around interoperability in that space.
Web服务应该是您的默认选择,因为在该空间中有很多关于互操作性的工作。
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.
我确定还有其他人。
#3
2
While Web Services (WS-*) might be the correct solution, getting stacks to interoperate can be kludgy.
虽然Web服务(WS- *)可能是正确的解决方案,但让堆栈进行互操作可能会很糟糕。
There is much to be said for HTTP + (POX | JSON) and REST-ian architecture.
HTTP +(POX | JSON)和REST-ian架构有很多要说的。
#4
0
You could use webservices.
你可以使用webservices。
Or you could use IVKM to embed the java code directly into a .NET assembly.
或者您可以使用IVKM将java代码直接嵌入到.NET程序集中。
#5
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.
我曾经在java后端工作过C#rich-client。他们通过网络服务进行沟通。我们真正遇到的唯一问题是继承层次结构,即Web服务WSDL擦除。
#6
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.
我相信在Java / .NET平台上使用Web服务存在一些互操作性问题。例如,一起使用Axis2和.net存在一些问题。在大多数情况下,存在变通方法。
I've heard some good comments about using REST-ian architecture though.
我听说过有关使用REST-ian架构的一些好评。
#7
0
There are several methods for creating/obtaining interoperability between java and .net systems.
有几种方法可用于创建/获取java和.net系统之间的互操作性。
- Web services
- Visual J#
- Java Native Interface (JNI)
- BytecodeTranslation
- Runtime Bridges
Java本机接口(JNI)
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.
Web服务是最常用的。 Web服务主要使用基于SOAP的通信机制,这种机制本身可能比其他二进制通信机制慢。 Web服务也不适合在Java和.NET之间传递自定义对象作为参数和返回值。
This article gives really good overview on what is what:
本文非常清楚地概述了什么: