Archived

This forum has been archived. Please start a new discussion on GitHub.

Querying the Object Adapter endpoints

How can I query (or get) the endpoints of my object adapter from code?
Because when it comes from an external config file, or uses the 'default' random assigned port number - it is unknown by me.

I want to do a reverse process as a StringToProxy() - I want to create a string which contains all the information to access a registered object on a server - create a string, which can be sent away in the net to other Ice client to use the StringToProxy() function.

I cannto use the IcePack possibility for some reasons for this purpose - this is why I want to find another way to solve this problem.

Comments

  • The only way I can think of is to create a proxy with ObjectAdapter :: createProxy() (use a dummy identity), and then convert it to a string representation with Communicator :: proxyToString().
  • Ice.ObjectPrx prx = adapter.createProxy(Ice.Util.stringToIdentity("xx"));
    string s = ic.proxyToString( prx );

    it generates: s = "xx -t@MyAdapter"

    so it doesn't work :(
  • Right, this doesn't work if you use indirect proxies. There is no way to access the endpoint information in this case.
  • Ooops, something wrong. It is on the server side. Not on the client side. The server creates the Object Adapter using a config file to read the endpoint definition from outside. What I wanna know is what are the final endpoints which are set by the ICE run-time for that O.A. How comes the indirect proxy here?
  • mes
    mes California
    You probably have an AdapterId property defined for your adapter. If you are not using indirect proxies, there is no need for this property.

    - Mark
  • Mes, you are right. I had an AdapterId... When I comment it out, it is worlking now. Thanks a lot! :)