Solved

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

Posted on 2001-08-06
9
242 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
Comment Utility
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
Comment Utility
Or use Corba.
0
 
LVL 3

Expert Comment

by:dnoelpp
Comment Utility
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
 
LVL 5

Expert Comment

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

highly scalable and extensible...light on security.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:dnoelpp
Comment Utility
How do you feel married, Droby?
0
 
LVL 1

Expert Comment

by:CyTG
Comment Utility
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
Comment Utility
> 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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now