5 # Import the CORBA module
6 from omniORB import CORBA
12 orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
14 # Obtain a reference to the root naming context
15 obj = orb.resolve_initial_references("NameService")
16 rootContext = obj._narrow(CosNaming.NamingContext)
18 if rootContext is None:
19 print "Failed to narrow the root naming context"
22 # Resolve the name "test.my_context/Echo.Object"
23 name = [CosNaming.NameComponent("test", "my_context"),
24 CosNaming.NameComponent("Echo", "Object")]
27 obj = rootContext.resolve(name)
29 except CosNaming.NamingContext.NotFound, ex:
30 print "Name not found"
33 # Narrow the object to an eo::Echo
34 echo = obj._narrow(eo.Echo)
37 print "Object reference is not an eo::Echo"
40 # Invoke the echoString operation
41 message = "Hello from Python"
42 result = echo.echoString(message)
44 print "I said '%s'. The object said '%s'." % (message,result)
61 s1=eo.S1(x=1,y=2,s="aa",b=True,vd=[1,2])
67 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=None)
68 r=echo.echoStruct2(s3)
76 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=ob)
77 r=echo.echoStruct2(s3)
80 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=oc)
81 r=echo.echoStruct2(s3)
84 r=echo.echoObjectVec([ob,ob])
87 r=echo.echoObjectVec([oc,oc])
90 r=echo.echoObjectVec([ob,oc])