CORBA Python Query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Akhilesh S. Shirbhate

    CORBA Python Query

    Sorry for reposting, but please help me... I desperately need help.

    I wrote a small CORBA program and am using ORBit-python.
    The IDL file was as below:
    ---------------------------
    module MESSAGING
    {
    typedef sequence<string > msgLines;
    struct msg
    {
    string fr;
    string to;
    msgLines body;
    };
    interface mail
    {
    void submit (in msg message);
    };
    };
    ---------------------------------



    The server program is as below:
    ---------------------------------
    #!/usr/bin/python
    import CORBA
    class mail:
    msg = 0
    def submit(self, msg):
    print "Message Recieved from:", msg.fr
    print "Message for:", msg.to
    for line in msg.body:
    print line
    self.msgs = self.msgs + 1;
    print "Message Served: ", self.msgs

    CORBA.load_idl( "msg.idl")
    CORBA.load_idl( "/usr/share/idl/name-service.idl")

    orb = CORBA.ORB_init( (), CORBA.ORB_ID)
    poa = orb.resolve_ini tial_references ("RootPOA")

    servant = POA.MESSAGING.m ail(mail())
    poa.activate_ob ject(servant)
    ref = poa.servant_to_ reference(serva nt)
    open("./msg-server.ior","w" ).write(orb.obj ect_to_string(r ef))
    print "Wrote IOR to file", orb.object_to_s tring(ref)
    poa.the_POAMana ger.activate()
    orb.run()
    ---------------------------------

    After running the program, it gives the following errors:
    ---------------------------------
    Traceback (innermost last):
    File "./msg-server.py", line 14, in ?
    CORBA.load_idl( "msg.idl")
    AttributeError: load_idl
    ---------------------------------

    If I change the CORBA.load_idl to CORBA._load_idl then the error comes
    at some other place... Namely below:

    ---------------------------------
    Traceback (innermost last):
    File "./msg-server.py", line 20, in ?
    servant = POA.MESSAGING.m ail(mail())
    NameError: POA
    ---------------------------------

    The CORBA module is dynamically loaded from the following file:
    /usr/lib/python1.5/site-packages/CORBAmodule.so

    I have installed orbit-python-0.3.0-1 on my machine.

    Please help me out.. I need help desperately to run the server :((
    Thanx in advance :)
  • Diez B. Roggisch

    #2
    Re: CORBA Python Query

    Akhilesh S. Shirbhate wrote:
    [color=blue]
    > ---------------------------------
    > Traceback (innermost last):
    > File "./msg-server.py", line 20, in ?
    > servant = POA.MESSAGING.m ail(mail())
    > NameError: POA
    > ---------------------------------[/color]

    No wonder, as you don't import a module named POA. As you seem to look for
    the generated class of your dynamically loaded idl, you might try to use
    the rootpoa, thus writing

    servant = poa.MESSAGING.m ail(mail())

    notice the lower case.

    If thats no help, look into the examples from orbit python, I bet you can
    find something working there.
    --
    Regards,

    Diez B. Roggisch

    Comment

    Working...