简体   繁体   English

将EJB应用程序共享到Rest服务中

[英]Share an EJB application into a rest service

(Sorry for my english, that not my first language, but I will try to be the more clear possible). (对不起我的英语,不是我的母语,但是我会尽量清楚一些)。

I have to make an application based on Java EJB that can communicate with other projects through RMI for some services. 我必须创建一个基于Java EJB的应用程序,该应用程序可以通过RMI与其他项目进行某些服务的通信。 But I also want to make some other services - that allow to proceed business functions on my entities - available through an REST interface. 但是我还想通过REST接口提供一些其他服务-允许在我的实体上继续进行业务功能。 And there is where I am lost. 还有我迷路的地方。

I created several projects on Netbeans : 我在Netbeans上创建了几个项目:

  • exampleApp which is composed of modules : exampleApp由模块组成:

    • exampleApp-ejb exampleApp-ejb
    • exampleApp-ear exampleApp-ear
    • exampleApp-web exampleApp-web
  • exampleAppShared (for my RMI service) exampleAppShared(用于我的RMI服务)

For the moment, my services look like : 目前,我的服务如下:

@Stateless
public class ServicesClient implements ServicesClientLocal {

@EJB
private GestionClientLocal gestionClient;

//code refering to business functions
}

My RMI part functions well. 我的RMI部分运行良好。 But I don't know how to make my services available through an REST services. 但是我不知道如何通过REST服务使我的服务可用。 Should I create another project ? 我应该创建另一个项目吗?

Maybe I did search badly but I didn't find some answers here or on internet about this case... 也许我确实搜索不好,但是在这里或在互联网上找不到关于这种情况的答案...

Thanks in advance for who will take some time to answer to my (idiot) question... 在此先感谢您花点时间回答我的(白痴)问题...

Finally I found ! 终于我找到了!

I just need to create with netbeans the REST webservice : 我只需要使用netbeans创建REST Web服务:

  • right click on the package you want to create your webservice 右键单击要创建Web服务的软件包
  • new
  • RestFul webservices from patterns 来自模式的RestFul Web服务

Just click the first screen and then choose the name of the webservice. 只需单击第一个屏幕,然后选择Web服务的名称。 Then you can do a call of an enterprise bean. 然后,您可以调用企业bean。

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

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