• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Java Calling C++ in a different (remote) server

Hi

Need some expert help on this.

Need to call existing C++ classes from my Java/Weblogic application :
1. The C++ classes resides in a separate/ remote server
2. The java application would pass some command in string over to the C++
3. The C++ would return result as data objects containing table/columns.

Not quite sure on how the connection between Java and C++.

Q1. Understand there is JNI - but JNI typically is for calling to C++ classes on same server right?

Q2. Remote server can be via socket call but what protocol would suit for call from Java to C++?

Q3. What would be a better implementation for such call?


Many Thanks

Rgds/chris
0
leechris
Asked:
leechris
2 Solutions
 
Droby10Commented:
maybe with rmi as the transport with jni proxy/stubs for each local piece...?
0
 
dnoelppCommented:
Or use Corba.
0
 
dnoelppCommented:
There are many possibilities:

1. RMI with JNI on the separate/remote server side to access the C++ classes. As Droby10 already suggested.

2. Corba but then your C++ classes need to have a Corba access/interface. As I already suggested.

3. HTTP where your C++ classes listen very much like a web server. In your case it might be very appropriate, because you said, you're transmitting strings. HTTP is a very simple protocol and rather easy to implement. The best of this is, it works through firewalls.

4. An own protocol with own ports. A variant of the HTTP solution. One limitation of HTTP is, that the server is not able to initiate a connection. This can be overcome with this solution. But I won't advise you to implement this. Because you mix up the client/server distinction. Your C++ classes should stay "server", your Java application should stay "client".

Other possibilities anyone?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Droby10Commented:
soap...?  (an implementation of you're #3 example)...

highly scalable and extensible...light on security.
0
 
dnoelppCommented:
How do you feel married, Droby?
0
 
CyTGCommented:
1. write a little server program, u know ServerSocket, and host it on a free port. Use Object Input/Output Streams (saves u the hazzle with RMI, does what u need), use the .exec to execute whatever u need on the server upon request

2. incorporate the networking into ur existing application

that should be it. But this to work, u have to execute Java on the remote server as well.
If thats not an option, u could do telnet sessions instead, thats pretty easily programmed.
0
 
Droby10Commented:
> use the .exec to execute whatever u need on
the server upon request

be sure to set limits (maybe a dictionary of allowed objects, commands, methods, etc. or a runtime security context)...

we had a hay-day during an audit a few months ago with an "enterprise" site that used remote instantiation/invokation such as this without any limits...

the funniest part was writing the "hacked by chinese" signia to client connections...i think it took a solid hour just for operations to verify that the solaris environment had not in fact been infected by the code-red worm.

---------------------

i guess i need to update my profile...

not to much has changed since the wedding...i still leave my underwear on the floor...she still erases my messages...but we're happy and that's the important thing.
0
 
lwinkenbCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Split points between droby10 and dnoelpp
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
lwinkenb
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now