[omniORB] RE: How to cdrMarshal CORBA.Any value?

Anton Dedov adedov at swsoft.com
Sat Dec 29 13:58:34 GMT 2007


Closed - I found decision my-self:

class MyAny:
                _NP_RepositoryId = "IDL:omg.org/CORBA/Any:1.0"
                def __init__(self, *args, **kw):
                                raise RuntimeError("Cannot construct objects of this type.")

_d_MyAny  = (omniORB.tcInternal.tv_any, omniORB.tcInternal.tv_any, 0)
_ad_MyAny = (omniORB.tcInternal.tv_alias, MyAny._NP_RepositoryId, "Any", (omniORB.tcInternal.tv_any, omniORB.tcInternal.tv_any, 0))
_tc_MyAny = omniORB.tcInternal.createTypeCode(_ad_MyAny)
omniORB.registerType(MyAny._NP_RepositoryId, _ad_MyAny, _tc_MyAny)
del MyAny

def insertCreds(name, ctx, exc = None):
                ...
                s = SecurityContext(...)
                sany = CORBA.Any(CORBA.TypeCode(CORBA.id(s)), s)
                smr = cdrMarshal(_tc_MyAny, sany)
                ctx.append( (sid, smr) )

--
Anton Dedov
Software Developer, PEM
SWsoft

From: omniorb-list-bounces at omniorb-support.com [mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of Anton Dedov
Sent: Friday, December 28, 2007 3:27 PM
To: omniorb-list at omniorb-support.com
Subject: [omniORB] How to cdrMarshal CORBA.Any value?

Hi!

I am trying form request context in interceptor via Python interface of omniORB. Our server part is working under ACE-TAO. Server-side interceptors wait for a context data encapsulated into Any. But I cannot marshal Any value with cdrMarshal:

>>> s = SecurityContext(...)
>>> s_any = CORBA.Any(CORBA.TypeCode(CORBA.id(s)), s)
>>> cdrMarshal(CORBA.TypeCode(CORBA.id(s_any)), s_any)
Traceback (most recent call last):
  File "<console>", line 1, in ?
  File "./omniORB/CORBA.py", line 480, in id
BAD_PARAM: CORBA.BAD_PARAM(omniORB.BAD_PARAM_WrongPythonType, CORBA.COMPLETED_NO)

Can anyone advise me how I can generate TypeCode for CORBA::Any. Or maybe I am trying to do something fundamentally wrong?

--
Anton Dedov
Software Developer, PEM
SWsoft

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20071229/fbb0a986/attachment.htm


More information about the omniORB-list mailing list