简体   繁体   English

应用程序之间的通信(.NET + Java)

[英]communicating between applications (.NET + java)

I have a pretty general question here. 我在这里有一个非常笼统的问题。 What is the best + reliable way for two applications running on the same machine to communicate with each other WITHOUT using web services or a web server of any kind. 在同一台计算机上运行的两个应用程序之间无需使用Web服务或任何类型的Web服务器就可以相互通信的最佳+可靠方法是什么。

as example: 例如:

application A: runs at .NET app that with active X controls can access another third party application and receive data. 应用程序A:在.NET应用程序上运行,该应用程序具有活动的X控件,可以访问另一个第三方应用程序并接收数据。

application B: (lets assume is running java) wants to be able to start a process in application A with specific parameters and receive information back from application A. (no web services allowed) 应用程序B :(假设运行Java)希望能够在应用程序A中启动具有特定参数的进程,并从应用程序A接收回信息。(不允许使用Web服务)

the only thing I can think of is perhaps application B executing a file with certain parameters...then application A does any work and writes any return information into a database...but I don't know how reliable this is...or how application A would know when the data has been written to the database. 我唯一想到的可能是应用程序B执行带有某些参数的文件...然后应用程序A进行任何工作并将任何返回信息写入数据库中...但是我不知道这有多可靠...或应用程序A如何知道何时将数据写入数据库。 (plus this sounds like a bit of a hackish solution to me..and was wondering is there anything better out there) (再加上这听起来像是对我来说有点棘手的解决方案。而且我想知道那里还有什么更好的选择)

alright...thanks for any help!.. 好...谢谢您的帮助!

Andrew 安德鲁

Using tcp sockets should be pretty reliable, even more so in the same machine. 使用tcp套接字应该非常可靠,甚至在同一台机器上也是如此。 It doesn't need web services, web servers, etc - just a socket on each side. 它不需要Web服务,Web服务器等-只是两端都有一个套接字。

In addition to all the answers I would alos like to say that I looked into WCF: http://en.wikipedia.org/wiki/Windows_Communication_Foundation 除了所有答案之外,我还想说我对WCF进行了研究: http : //en.wikipedia.org/wiki/Windows_Communication_Foundation

This is what I am going to use. 这就是我要使用的。 I found this article very helpful: 我发现这篇文章非常有帮助:

http://bloggingabout.net/blogs/dennis/archive/2007/04/20/wcf-simple-example.aspx http://bloggingabout.net/blogs/dennis/archive/2007/04/20/wcf-simple-example.aspx

A socket will be fairly easy to setup; 一个套接字将很容易设置; however I suggest looking into something more akin to SOAP or XMLRPC - both will be a lot easier when it comes to packing and unpacking the data. 但是,我建议研究更类似于SOAP或XMLRPC的东西-当打包和解压缩数据时,两者都将容易得多。 Both .NET and Java both have extensive access and libraries availible for both XMLRPC and SOAP (both providers and consumers). .NET和Java都具有广泛的访问权限,并且XMLRPC和SOAP(提供者和使用者)都可以使用库。

As far as implementation is concerned, TCP sockets and web services are about as easy to set up on either side (client-server). 就实现而言,TCP套接字和Web服务在任一端(客户端-服务器)上都易于设置。

When performance is a consideration, TCP sockets will have the upperhand since there is less overhead. 考虑性能时,TCP套接字将占上风,因为开销较小。

But when it comes to useability, and ease of integration in the code I prefer web services. 但是,在可用性和易于集成代码方面,我更喜欢Web服务。 And honestly it is a much more transparent technology when it comes to debugging your code. 老实说,在调试代码时,它是一种更加透明的技术。 The sockets counterpart will require more plumbing code before it gets useable. 套接字副本将需要更多的管道代码,然后才能使用。

Check out this article for more info on .NET and Java intercommunication via Web Services. 请查看本文 ,以获取有关.NET和通过Web服务进行Java互通的更多信息。

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

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