import sys from omniORB import CORBA, any import omniORB import myIDL import myIDL__POA orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) ior = sys.argv[1] obj = orb.string_to_object(ior) myInterfaceObj = obj._narrow(myIDL.myInterface) if myInterfaceObj is None: print "Object reference is not an myIDL.myInterface" sys.exit(1) myControlStruct = myIDL.control( operationType = 1, transportedObject = any.to_any( [ myIDL.myTextListEntry ( 1, "Text 1" ), myIDL.myTextListEntry ( 2, "Text 2" ), myIDL.myTextListEntry ( 3, "Text 3" ) ] ) ) # first try: the structure try: result = myInterfaceObj.transmit(any.to_any(myControlStruct)) print "object sent !" except (CORBA.BAD_PARAM, CORBA.COMM_FAILURE, CORBA.COMPLETED_MAYBE), ex: print "exception catched: ", ex # second try: only a string try: result = myInterfaceObj.transmit(any.to_any("This is only a string")) print "object sent !" except (CORBA.BAD_PARAM, CORBA.COMM_FAILURE, CORBA.COMPLETED_MAYBE), ex: print "exception catched: ", ex