[omniORB] LOCATION_FORWARD not working in Python?

Rob Riggs rob at pangalactic.org
Fri Feb 4 16:28:03 GMT 2005


Well, it looks like without _dispatch() or DSI in Python, there is no 
easy way to provide an omniMapper-like service in Python.  I have tried 
a few hacks, including implementing my own _omni_op_d descriptor class 
to capture accesses to the servant method dictionary, but CPython 
short-circuits method lookup on built-in types when called from a C 
module, and omniORB demands _omni_op_d be a DictType.

I am curious though.  From the trace I got of the client, it seems to 
"forget" the LOCATION_FORWARD it receives when performing _is_a() and 
tries to contact the mapper to invoke the remote method.  Is this the 
desired behavior?  I understand that it is probably compliant behavior.  
It just seems inefficient.

omniORB: Client attempt to connect to giop:tcp:localhost:9998   <--- 
_is_a() called on mapper
omniORB: AsyncInvoker: thread id = 2 has started. Total threads = 1
omniORB: Scavenger task execute.
omniORB: Client opened connection to giop:tcp:127.0.0.1:9998
omniORB: sendChunk: to giop:tcp:127.0.0.1:9998 77 bytes
omniORB: inputMessage: from giop:tcp:127.0.0.1:9998 164 bytes
omniORB: Creating ref to remote: root<0>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:Hello/IHello:1.0
omniORB: GIOP::LOCATION_FORWARD -- retry request.  <--- forwarded
omniORB: omniRemoteIdentity deleted.
omniORB: ObjRef(IDL:Hello/IHello:1.0) -- deleted.
omniORB:  send codeset service context: (ISO-8859-1,UTF-16)
omniORB: Client attempt to connect to giop:tcp:209.120.188.9:47248  <--- 
_is_a() called on real object
omniORB: Client opened connection to giop:tcp:209.120.188.9:47248
omniORB: sendChunk: to giop:tcp:209.120.188.9:47248 105 bytes
omniORB: inputMessage: from giop:tcp:209.120.188.9:47248 25 bytes
omniORB: Creating Python ref to remote: key<Hello>
 target id      : IDL:Hello/IHello:1.0
 most derived id:
omniORB: LocateRequest to remote: key<Hello>
omniORB: sendChunk: to giop:tcp:127.0.0.1:9998 25 bytes  <--- back to 
calling the mapper again
omniORB: inputMessage: from giop:tcp:127.0.0.1:9998 20 bytes
omniORB: sendChunk: to giop:tcp:127.0.0.1:9998 52 bytes
omniORB: inputMessage: from giop:tcp:127.0.0.1:9998 72 bytes
object reference created: <omniORB.CORBA.Object instance at 0x4088826c>
hello object narrowed: <Hello._objref_IHello instance at 0x4088812c>
Traceback (most recent call last):
  File "./HelloClient.py", line 19, in ?
    print hello.hello()
  File "/tmp/tmpplAotA", line 46, in hello
omniORB.CORBA.BAD_OPERATION: Minor: 
BAD_OPERATION_UnRecognisedOperationName, COMPLETED_NO.


Rob Riggs wrote:

> Hi everyone,
>
> I'm trying to duplicate some of the omniMapper functionality in 
> Python.  I've got LOCATION_FORWARD working out of a ServantLocator 
> using the ForwardRequest exception.  But I wanted to try something 
> with the INSPOA so that I could use corbaloc URIs.  That requires I 
> use omniORB's LOCATION_FORWARD exception.  The code I wrote tries to 
> duplicate (very simply) in Python the code for omniMapper.  The 
> problem is that it does not seem to work.  I can see that requests 
> come through and that a LOCATION_FORWARD is thrown.  But the client 
> (another python program) appears to be ignoring the LOCATION_FORWARD 
> message.
>
> The client is failing with a CORBA.BAD_OPERATION exception.  This 
> appears to be because the client is still trying to contact the mapper 
> servant.
>
> I've attached the code I'm using.  It's pretty much a Python 
> interpretation of the redirection bits of omniMapper.  It takes an OID 
> on the command line and creates and object with the id of "Hello".
>
> Invoke a server.  Invoke the mapper as ./mapper.py -ORBendPoint 
> giop:tcp::9998 IOR:01000... (IOR of the server). Have a client attach 
> at corbaloc:iiop:localhost:9998/Hello
> The result should be a BAD_OPERATION exception in the client.  You 
> should see the connection and redirection being logged by the server.
>
> I am guessing that its something obvious that I just cannot see at 
> this point.
>
> One thing that this program does not have that omniMapper does is a 
> _dispatch() function.  Is _dispatch() supported under Python?  When I 
> did have a _dispatch(), it was never called.
>
> Can anyone shed some light on what I am doing wrong here?
>
> I'm running omniORB-4.0.5, omniORBpy-2.5, Python 2.3.4 on Fedora Core 3.
>
> Regards,
>
> -Rob
>
> #!/usr/bin/env python
>
> import sys
> import omniORB
> import Mapper__POA
>
> from omniORB import CORBA
>
> class Mapper(Mapper__POA.IMapper):
>       def __init__(self, name, ref):
>
>        self.name = name
>        self.ref = ref
>        poa.activate_object_with_id(name, self)
>
>    def redirect(self):
>           print "forwarding", self.name,
>        print "to:", self.ref
>        print orb.object_to_string(self.ref)
>        raise omniORB.LOCATION_FORWARD(self.ref)       
>    def _is_a(self, objType):
>           self.redirect()
>        return 1
>
> # Initialise the ORB and activate the root POA.
> orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
> poa = orb.resolve_initial_references('omniINSPOA')
> poaManager = poa._get_the_POAManager()
> poaManager.activate()
>
> # Create the Servant with the mapped ref
> ref = orb.string_to_object(sys.argv[-1])
> dsi = Mapper('Hello', ref)
> orb.run()
>
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list





More information about the omniORB-list mailing list