• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling C++ APIs from an EJB

 
K N
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to call some C++ APIs from my EJB. These APIs might be available on the local machine (same machine as the App Server - WebLogic) or may be available on a remote machine. How can I accomplish this and which type of bean do I use ?
Thanks,
Kapil
 
Tim Holloway
Bartender
Posts: 18417
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Considering your needs, I think probably the best approach would be to setup a CORBA wrapper for the C++ service and invoke the C++ methods using remote calls.
The choice of EJB depends on context, though most likely you'd select a Session bean, since you're apparently more interested in business logic than data access here.
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also use an RMI service that is colocated with the C++ code and uses JNI to make the calls. Weblogic provides startup classes to accomplish this. You bind the service to a JNDI name and your beans can use lookup to get an instance and make the calls.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would avoid CORBA if I could. I like the idea of a co-located Java proxy using JNI to get to the C++ service. Then you could put the Java proxy in a different WebLogic server or even set it up as a servlet proxy.
 
K N
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
First of all I really thank you for your prompt replies. I am relatively new to the area of J2EE so if you could please help me with pointers / code / documentation on the respective approaches suggested, it would be a GREAT HELP.
Thanks again,
Kapil
 
Tim Holloway
Bartender
Posts: 18417
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Main problem with JNI is that it ties you to solving the specific problem in the specific environment, and my experience is that if something's really useful, people will come back demanding you employ it in ways you'd never have imagined.
While CORBA might have more overhead, it's more general (especially if you're one of those funky shops around here that wants to tie AS/400 RPG apps to Java - or at least other C++ apps), and it's probably going to be a little easier to maintain, since you have a consistent set of well-defined standards to work in.
CORBA got a bad name early because of initial compatability problems, but allegedly that's history.
Or was there something I don't know here?
 
Viswanatha GB
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..
If your planing to use of Weblogic 7.0 it could be very easy i think. since it provides new concept called JCOM where u can easly intract with C++ COM objec as ur API.
Ref:
http://edocs.bea.com/wls/docs70/jcom/index.html
 
K N
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We will be sticking to WebLogic 6.1 I guess. If anybody can point me to any site / example it would be a great help
 
Alex Iordache
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kapil Nagpal:
We will be sticking to WebLogic 6.1 I guess. If anybody can point me to any site / example it would be a great help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!