使用Excel中的EJB的最佳解决方案

时间:2020-03-06 14:20:37  来源:igfitidea点击:

我们希望从Excel中访问某些EJB。目的是提供可从VBA使用的API。

我们的EJB主要是无状态会话Bean,它们使用POJO进行简单的CRUD操作。

一些可能的解决方案:

  • 将EJB公开为Web服务,并创建一个将它们包装的VB / C#dll,
  • 使用Corba从C#访问EJB,
  • 创建一个使用Java访问EJB的COM库,

欢迎提供指向这些解决方案或者其他想法的框架的指针。

解决方案

我们可以看一下IIOP.NET,它可以解决此问题。

如果ejb容器是最近的容器,那么最便宜,最简单的方法就是将bean作为Web服务公开,并从VB / C#调用它。这不需要任何额外的工具或者库。

回到VB6 / COM / DCOM时代,我们使用套件J-Integra来完成此任务。我没有.NET版本的经验。

我强烈推荐IKVM。它是.NET汇编编译器的Java字节代码(即JAR-> DLL),我用它在Excel自动化服务器中创建实时JMX链接和侦听器。创建EJB客户端存根和支持库的.NET程序集应该并不困难。

//尼古拉斯

我在一个名为XLLoop的开源项目上工作,该框架允许我们将POJO函数公开为Excel函数。

它包括:

  • Excel外接程序(XLL),可通过TCP与以下对象进行通信:
  • Java服务器/库,它调用java方法。

我们可以将此Java函数服务器嵌入EJB中,并将其作为应用服务器的一部分进行部署。

我们可以尝试Obba(我正在从事此项目):

Obba is a Java object handler for spreadsheet applications.
  
  It provides a bridge between spreadsheets and Java classes, such that spreadsheets can be used as graphical user interface for Java libraries. Accessing your Java library form the spreadsheet requires no glue code (no VBA needed, no special Java code needed). Objects are instantiated by their original constructor. Constructors and methods are invoked using a "by name" reflection. A spreadsheet-specific factory method is not necessary. Obba provides the functions to handle objects in spreadsheets.
  
  The Java virtual machine providing the add-in may run on the same computer or a remote computer - without any change to the spreadsheet, i.e., object referenced in the spreadsheet can reside on remote Java virtual machine.