<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks Jan and Duncan for your help, I really appreciate it.&nbsp; I
wouldn't have been able to figure this out myself.<br>
<br>
Just a small question though.&nbsp; I'm using the default POA policy so
there should be only POA in this application.&nbsp; Is there a way to query
the object reference for its POA?&nbsp; If not, I can keep the POA in a
global place but just thought that if there was a way to get to it, I
wouldn't even have to do that.<br>
<br>
Thanks again,<br>
Tuyen,<br>
<br>
Duncan Grisby wrote:
<blockquote cite="midE1GQ6Cv-0006Ft-C3@apasphere.com" type="cite">There's
no need to use reference_to_id then id_to_servant -- you can<br>
  <pre wrap="">just use reference_to_servant to go there directly.

Note that in case it's not obvious, you have to call these methods on
the POA that the servant is activated in, otherwise you get exceptions.

[...]
  </pre>
  <blockquote type="cite">
    <pre wrap="">But getting to the servant instance from the id_to_servant() call is far
more tricky than I initially thought. I eventually got to this

  PortableServer::ServantBase_var servant_base_ref =
the_poa-&gt;id_to_servant(id);
  MyObject_i* this_ref =
dynamic_cast&lt;MyObject_i*&gt;(servant_base_ref.in());
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Yes, that's what you have to do -- I don't think it's tricky to have to
use dynamic_cast&lt;&gt; -- there's no other way you could do it, since the
class you want to cast to is application-defined.

Cheers,

Duncan</pre>
</blockquote>
</body>
</html>