Probelm in marshaling Any with typecode/value of struct

Ajay Kapoor Ajay.Kapoor at cosinecom.com
Wed Apr 3 20:53:13 EST 2002


 


 


Hi , 

      I am trying to pass a structure as CORBA.Any. I am constructing the
TypeCode using the stringified Fnorb id. 
      But at the runtime while sending the corba request I get the
marshaling error for CORBA.Any 
     Here is the code snippet for what I am doing 

    idl definition 
----------------------------------- 
     module agent { 

             interface GenericAgent 
                { 

                      struct NameValuePair 
                        { 
                         string name; 
                          any value; 
                    }; 
                struct Subnet 
                { 
                    string address;  /* 32 bit mask  */ 
                    short mask;      /* 0..32        */ 
                }; 
           } }; 

Now I am trying this 

  # got the corba object reference some how 
     agent =  reference 
     sn_tc =CORBA.TypeCode("IDL:cosinecom/agent/common/Subnet:1.0")  #
string is the Fnorb generated ID 
     srcSubnet =
agent.NameValuePair("sourceSubnet",CORBA.Any(sn_tc,Subnet("3.3.3.3",24))) 
...... 
     # making the request 
      agent.createObject(srcSubnet) 



------------------------------------------------------------------ 

I have also tried using 
tc=  CORBA.TypeCode(CORBA.id(Subnet) )  to construct the typecode and use it
with Any . But that also failed. 

I am getting the following error in all the cases. 

 File
"/vobs/orion/cosine/agent_cli/generated/fnidl/cosinecom/agent/__init__.py",
line 85, in createObject 
    apply(request.invoke, args, kw) 
  File "/dvlp/akapoor/Python-1.5.2/Lib/site-packages/Fnorb/orb/DII.py", line
160, in invoke 
    (forwarded, self.__results) = client.synchronous(self, args) 
  File
"/dvlp/akapoor/Python-1.5.2/Lib/site-packages/Fnorb/orb/GIOPClient.py", line
117, in synchronous 
    self.__marshal_parameters(cursor, request.inputs(), parameters) 
  File
"/dvlp/akapoor/Python-1.5.2/Lib/site-packages/Fnorb/orb/GIOPClient.py", line
461, in __marshal_parameters 
    typecode._fnorb_marshal_value(cursor, parameters[i]) 
  File "/dvlp/akapoor/Python-1.5.2/Lib/site-packages/Fnorb/orb/TypeCode.py",
line 2121, in _fnorb_marshal_value 
    self._element_type._fnorb_marshal_value(cursor, element) 
  File "/dvlp/akapoor/Python-1.5.2/Lib/site-packages/Fnorb/orb/TypeCode.py",
line 1476, in _fnorb_marshal_value 
    member.type._fnorb_marshal_value(cursor, dict[py_member_name]) 
  File "/dvlp/akapoor/Python-1.5.2/Lib/site-packages/Fnorb/orb/TypeCode.py",
line 794, in _fnorb_marshal_value 
    value._fnorb_marshal(cursor) 
  File "/dvlp/akapoor/Python-1.5.2/Lib/site-packages/Fnorb/orb/Any.py", line
77, in _fnorb_marshal 
    self.__typecode._fnorb_marshal(cursor) 
  File "/dvlp/akapoor/Python-1.5.2/Lib/site-packages/Fnorb/orb/TypeCode.py",
line 216, in _fnorb_marshal 
    cursor.marshal('L', self._kind.value()) 
AttributeError: 'string' object has no attribute 'value' 


Can somebody help me. 

Thanx 
Ajay Kapoor 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20020403/1ae74274/attachment.html>


More information about the Python-list mailing list