Solved

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

Posted on 2001-08-06
9
251 Views
Last Modified: 2010-05-18
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
Comment
Question by:leechris
9 Comments
 
LVL 5

Accepted Solution

by:
Droby10 earned 50 total points
ID: 6358097
maybe with rmi as the transport with jni proxy/stubs for each local piece...?
0
 
LVL 3

Assisted Solution

by:dnoelpp
dnoelpp earned 50 total points
ID: 6358287
Or use Corba.
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6358305
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 5

Expert Comment

by:Droby10
ID: 6359262
soap...?  (an implementation of you're #3 example)...

highly scalable and extensible...light on security.
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6359338
How do you feel married, Droby?
0
 
LVL 1

Expert Comment

by:CyTG
ID: 6361591
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
 
LVL 5

Expert Comment

by:Droby10
ID: 6361679
> 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
 
LVL 5

Expert Comment

by:lwinkenb
ID: 8937329
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Should localization be done inside spring controller 5 32
difference of if loops 23 60
String array comparison 4 38
swing controls 2 15
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question