Building an CORBA Client to the RMI/IIOP Server
Gopalan Suresh Raj
work with any of these samples, you will need the
.........................................JDK 1.3 or Higher (I use JDK version 1.4)
.........................................The COS Naming JNDI Service Provider (I use JNDI version 1.2.1)
Building CORBA Client to the RMI/IIOP Server
The various steps that are involved in creating a CORBA Client to our RMI/IIOP Server are as follows:
Create the Client class
Compile the IDL File and generate the Stubs and Skeletons
Compile the Client Application
Make sure the Server is running and then startup the Client
1. Create the Client Class File
Create the CORBA Client - CorbaClient.java - in a package called CorbaClient. You create the ORB object as shown on Line 37 that is used to communicate with the IIOP Server. Using the ORB, you find the naming service as shown on Lines 38 and 39. Using the naming service, you find the server as shown on Lines 43 through 45. Any message sent to the server component will be converted to IIOP and sent to the server and back.
2. Compile the IDL file and generate the Stubs and Skeletons
To run this client, you need to generate the appropriate stubs and skeletons using the idlj.exe compiler.
-v -i . -i C:\java\jdk1.4\lib -fclient -td CorbaClient SimpleStocks\StockMarket.idl
done - C:\java\jdk1.4\lib\ir.idl
done - C:\java\jdk1.4\lib\orb.idl
done - SimpleStocks\StockMarket.idl
done - SimpleStocks
3. Compile the CORBA Client
-classpath .;.\CorbaClient .\CorbaClient\CorbaClient.java
4. Make sure that the Servers are running and startup the client
Make sure that the Servers are up. If they are not, start them up using the following commands.
tnameserv -ORBInitialPort 1000
C:\MyProjects\Cornucopia\iiop>start java -classpath . StockMarketServer
The screen shot below shows the COS Naming Services Server up and running.
The screen shot below shows our RMI Server up and running across Client invocations
Startup the Client as shown below, and invoke operations on the Server.
-classpath .;.\CorbaClient CorbaClient.CorbaClient -ORBInitialPort 1000
The ORB has been created and initialized ...
The Object Reference has been resolved in Naming ...
The price of MY COMPANY is 159.2
|Java/RMI - Under The Hood|
|Developing a Java/RMI Server using JRMP|
|Developing a Java/RMI Client using JRMP|
|Developing a Java/RMI Server Component using IIOP|
|Developing a Java/RMI Client to our RMI/IIOP Server Component|
|Developing a CORBA Client to our RMI/IIOP Server Component|
Download the entire source code as a zip file.
click here to go
My Advanced Java/J2EE Tutorial Page...
|About the Author...|
|Gopalan Suresh Raj is a Software Architect, Developer and an active Author. He has co-authored a number of books including "Professional JMS", "Enterprise Java Computing-Applications and Architecture" and "The Awesome Power of JavaBeans". His expertise spans enterprise component architectures and distributed object computing. Visit him at his Web Cornucopia© site (http://gsraj.tripod.com/) or mail him at firstname.lastname@example.org.|
This site was developed and is maintained by Gopalan Suresh Raj
Last Updated : Jan 13, '02
All products and companies mentioned at this site are trademarks of their respective owners.