RMI-IIOP
Building an CORBA
Client to the RMI/IIOP Server
Note |
To
work with any of these samples, you will need the
following: .........................................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.
CorbaClient/CorbaClient.java | ||
|
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.
Command Prompt |
C:\MyProjects\Cornucopia\iiop>idlj
-v -i . -i C:\java\jdk1.4\lib -fclient -td CorbaClient SimpleStocks\StockMarket.idl Parsing SimpleStocks\StockMarket.idl Parsing C:\java\jdk1.4\lib\orb.idl Parsing C:\java\jdk1.4\lib\ir.idl done - C:\java\jdk1.4\lib\ir.idl done - C:\java\jdk1.4\lib\orb.idl done - SimpleStocks\StockMarket.idl Generating SimpleStocks done - SimpleStocks C:\MyProjects\Cornucopia\iiop> |
3. Compile the CORBA Client
Command Prompt |
C:\MyProjects\Cornucopia\iiop>javac
-classpath .;.\CorbaClient .\CorbaClient\CorbaClient.java C:\MyProjects\Cornucopia\iiop> |
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.
Command Prompt |
C:\MyProjects\Cornucopia\iiop>start
tnameserv -ORBInitialPort 1000 C:\MyProjects\Cornucopia\iiop>start java -classpath . StockMarketServer C:\MyProjects\Cornucopia\iiop> |
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.
Command Prompt |
C:\MyProjects\Cornucopia\iiop>java
-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 C:\MyProjects\Cornucopia\iiop> |
|
Java/RMI |
|
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
to
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 (https://gsraj.tripod.com/) or mail him at gopalan@gmx.net. |
This site was developed and is maintained by Gopalan Suresh Raj |
Last Updated : Jan 13, '02 |
Copyright (c) 1997-2002, Gopalan Suresh Raj - All rights reserved. Terms of use. |
All products and companies mentioned at this site are trademarks of their respective owners. |