summaryrefslogtreecommitdiff
path: root/src/YalpClients/EflClient/corba_test.py
blob: e43249954f3e8cd7ddac2eee22dcd0fb6b31de5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python  
 
import sys  
from omniORB import CORBA, PortableServer  
#import Example  
import CosNaming, YalpInterfaces, YalpInterfaces__POA
 
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")  
 
obj = orb.resolve_initial_references("NameService")
root_context = obj._narrow(CosNaming.NamingContext)

if root_context is None:
        print "Failed to narrow the root naming context"
        sys.exit(1)  

name = "YALP_Server"

try:
        yalp = root_context.resolve(name)
        print "new aptd:apt object bound"

except CosNaming.NamingContext.NotFound, ex: 
	print "Name not found" 
	sys.exit(1) 

if yalp is None: 
	print "Object reference is not an Example::Echo" 
	sys.exit(1) 

message = "Hello from Python"
 
result = yalp.ping(err)
	
poaManager = poa._get_the_POAManager()
poaManager.activate()

orb.run()