[英]Is still useful to implement EJB with RMI when you can implement Web Services (SOA/REST)?
This might sound similar to this , but it's not. 这可能听起来与此类似,但事实并非如此。
I kind of understand EJB and RMI, and I have been working with web services under SOA for a while. 我有点理解EJB和RMI,而且我已经在SOA下使用Web服务了一段时间。 I want to know why is useful to work using EJB exposing remote interfaces under RMI instead of publishing Web Services (SOA/REST, but mostly SOA).
我想知道为什么使用EJB暴露RMI下的远程接口而不是发布Web服务(SOA / REST,但主要是SOA)是有用的。 I'm not asking which one is better, just I want to know a very good reason of why should I prefer to implement EJB with remote interfaces over Web Services.
我不是在问哪一个更好,只是我想知道为什么我更喜欢通过Web服务实现带有远程接口的EJB的一个很好的理由。
I have reviewed a lot of webpages but all seemed outdated. 我查看了很多网页,但似乎都过时了。 Until now, what I have is that EJB exposing remote interfaces is only better than WS when integrating with Java legacy system.
到目前为止,我所拥有的是,在与Java遗留系统集成时,暴露远程接口的EJB仅比WS更好。 If I want to manage transactions I could implement EJB with local interfaces.
如果我想管理事务,我可以使用本地接口实现EJB。 Also I don't think choosing EJB over RMI is more efficient than a Web Service interface.
另外,我不认为选择EJB over RMI比Web Service接口更有效。
Am I right? 我对吗? Is there something I'm missing?
有什么我想念的吗?
Really thanks in advance. 非常感谢提前。
EJBs are better if 如果是,EJB更好
Why (REST) Web services are so popular then? 为什么(REST)Web服务如此受欢迎? EJBs can be connected only to another Java application.
EJB只能连接到另一个Java应用程序。 Majority of modern Rich Internet Applications are written in JavaScript, so the only way to connect them with any backend is to use some kind of web service (usually REST + JSON).
大多数现代富Internet应用程序都是用JavaScript编写的,因此将它们与任何后端连接的唯一方法是使用某种Web服务(通常是REST + JSON)。 For such applications EJBs are pretty useless.
对于这样的应用程序,EJB很没用。
Both the client and service must be written in Java if you use RMI as the wire protocol. 如果使用RMI作为有线协议,则必须使用Java编写客户端和服务。
SOAP uses XML over HTTP, and REST uses pure HTTP for communication between client and service. SOAP使用XML over HTTP,而REST使用纯HTTP进行客户端和服务之间的通信。 Either end of the conversation can be written in any language that can send appropriate requests over HTTP, which is far less restrictive.
对话的任何一端都可以用任何可以通过HTTP发送适当请求的语言编写,这种限制要少得多。
I think this is one reason why web services over HTTP have won out over RMI. 我认为这是HTTP上的Web服务胜过RMI的一个原因。 Simple and open win, every time.
每次都是简单而开放的胜利。
They are different things for different purposes. 它们是用于不同目的的不同东西。
EJBs are for use within an N -tier system that is tightly coupled and you are in control of all elements. EJB用于紧密耦合的N层系统,您可以控制所有元素。 They offer direct coding in the language using what appear to be ordinary method calls, and LAN-type performance over IIOP or whatever other protocol the EE vendor has deployed.
它们使用看似普通的方法调用,以及IIOP上的LAN类型性能或EE供应商已部署的任何其他协议,提供语言的直接编码。
SOAP/REST is best for use across the Internet, or in B2B or other situations where you aren't in control of both ends and you need loose coupling. SOAP / REST最适合在Internet上使用,或者在B2B或其他无法控制两端且需要松散耦合的情况下使用。 You get much slower performance due to all the XML, but you also get an industry standard protocol in the middle which gives both ends protection against single-sourcing problems.
由于所有XML,您的性能会慢得多,但您也可以在中间获得行业标准协议,从而为单一来源问题提供双端保护。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.