Nutty Loaf
2011-07-22 20:06:16 UTC
Hi all
I'm new to CORBA and I'm finding it very difficult to understand.
Can anyone please explain with a short example how to use returned values
and out parameters.
For example, I have a Python class to use in the servant code like this:
## servant starts ##
class servicehelper_i (services.servicehelper):
def __init__ (self):
self.clientid = None
def create_client (self, dictClient, template):
try:
clientid = createClientProcess (dictClient, template)
self.clientid = clientid
success = 1
except:
success = 0
return success
## servant ends ##
This is the IDL, which I think must have something wrong:
module services
{
struct dictClientDetails
{
string company;
string contactname;
string login;
string password;
};
interface servicehelper
{
boolean create_client (in dictClientDetails client_details, in string
template_name, out long clientid);
}
}
The client code I've written is:
### client starts ###
from omniORB import CORBA
import services
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
ior = sys.argv[1]
obj = orb.string_to_object(ior)
objService = obj._narrow (services.servicehelper)
dictClient = services.servicehelper.dictClientDetails ("test_company11",
"testname11", "test11", "mypasswordis11")
result = objService.create_client (dictClient, "Standard")
### client ends ###
How do I access the clientid attribute?
I've tried putting a third argument in the call to create_client but this
doesn't work.
I don't seem to get anything in the "result" variable.
Looks like my code must have lots of mistakes, which I can't identify.
Any help is appreciated.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20110722/e5dfeb34/attachment.htm
I'm new to CORBA and I'm finding it very difficult to understand.
Can anyone please explain with a short example how to use returned values
and out parameters.
For example, I have a Python class to use in the servant code like this:
## servant starts ##
class servicehelper_i (services.servicehelper):
def __init__ (self):
self.clientid = None
def create_client (self, dictClient, template):
try:
clientid = createClientProcess (dictClient, template)
self.clientid = clientid
success = 1
except:
success = 0
return success
## servant ends ##
This is the IDL, which I think must have something wrong:
module services
{
struct dictClientDetails
{
string company;
string contactname;
string login;
string password;
};
interface servicehelper
{
boolean create_client (in dictClientDetails client_details, in string
template_name, out long clientid);
}
}
The client code I've written is:
### client starts ###
from omniORB import CORBA
import services
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
ior = sys.argv[1]
obj = orb.string_to_object(ior)
objService = obj._narrow (services.servicehelper)
dictClient = services.servicehelper.dictClientDetails ("test_company11",
"testname11", "test11", "mypasswordis11")
result = objService.create_client (dictClient, "Standard")
### client ends ###
How do I access the clientid attribute?
I've tried putting a third argument in the call to create_client but this
doesn't work.
I don't seem to get anything in the "result" variable.
Looks like my code must have lots of mistakes, which I can't identify.
Any help is appreciated.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20110722/e5dfeb34/attachment.htm