3
votes

I have application in CORBA using IIOP protocol, i am using the Java IDL component of the JDK 6 , another ORB implementation.

Implementation of both client and server in Java language.

Is there any way in the JDK ORB implementation to get the client ORB`s host and port from the server (ORB)code ?

Or

is there any way with use of IIOP protocol, get client the host and port ?

This is we are doing for identification of the client to track the who is requested

3
Can you explain your problem better? I think you resolve your problem in a different way.Makah

3 Answers

2
votes

I don't think there is any portable way to do this. Perhaps there is for your particular ORB, I don't know. Recall that CORBA tries very hard to hide the transport details from the application. The application may not even be using IIOP, and thus there would be no way to get TCP host and port information in any event.

You may want to consider adding additional identifier parameter(s) to your IDL so that the server can recognize clients. You may also consider making the clients call a "register" function on the server, and the server hands out an identifier that all clients must pass back to the server on subsequent calls.

This identifier can be as simple as a string or integer, or as complicated as some kind of security token that the server has to validate with a public key. It all depends on your application's requirements.

1
votes

It depends on the situation but sometimes you need to extract host/port from IOR for testing, logging, debugging purposes. IOR contains host and port, you only need to decode it from byte array that IOR represents. So just take CORBA specification and IorParser.java(massive dependencies) from GNU Classpath as example and do decoding yourself if you have time during weekend :)

If you do not have time as me, you can use command line utilities that are coming with ORBs:

  1. tao_catior in TAO/ACE ORB
  2. iordump in Orbix/Orbacus ORB's
  3. Parse IOR with web online tool http://www2.parc.com/istl/projects/ILU/parseIOR/
  4. Have not found possibility to use JDK CORBA to do the parsing. Although the code is definitely somewhere in internal sun packages.
  5. dior in Jacorb ORB. Or java jacorb.Orb.util.PrintIOR -i [IOR-string]

For me the answer #5 was good enough. I used Jacorb for my java based testing tool. But then again PrintIOR requires org.jacorb.orb.ORB to be instantiated by org.omg.CORBA.ORB.init(). So it can be tricky if you are forced to use JDK ORB in the same JVM.