[omniORB] LOCATION_FORWARD not working in Python?

Rob Riggs rob at pangalactic.org
Fri Feb 4 01:33:52 GMT 2005


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()




More information about the omniORB-list mailing list