Discussion:
[omniORB] TypeCode Any problems
Josip Broz
2010-05-17 21:48:44 UTC
Permalink
Hello,

I have a following problem with typeCode and Any. It will be a little bit
long but it is complicated. I am using the latest omniorb, compiled from
source

I have a self made idl file. I do no use omniidl for cc creation, everything
is done by hand, and must be done by hand.

Idl:

struct a

{

string n;

any v;

long f;

short l;

};



typedef sequence<a> alist;

typedef sequence<alist> alistlist;



interface _interface

{

alist exec (in string s, in alist arg )

}

First problem, that the a.v is type any, and the software is using this
opportunity, and putting a alist in there from a, what contains a alistlist.



CORBA::Request_ptr req = obj->_request("exec");

req->add_in_arg("arguments") = the string

req->add_in_arg("arguments") = the arg



I create a TypeCode for the ?a?

CORBA::StructMemberSeq tc;

tc.length(4);

tc [0].name = CORBA::string_dup("n");

tc [0].type = CORBA::TypeCode::_duplicate(CORBA::_tc_string);

tcs[1].name = CORBA::string_dup("v");

tc[1].type = CORBA::TypeCode::_duplicate(CORBA::_tc_any);

tc [2].name = CORBA::string_dup("f");

tc [2].type = CORBA::TypeCode::_duplicate(CORBA::_tc_long);

tc [3].name = CORBA::string_dup("l");

tc [3].type = CORBA::TypeCode::_duplicate(CORBA::_tc_short);

CORBA::TypeCode_var tc_var = orb->create_struct_tc("IDL:c/*l*/*c*/*s*/a:1.0"
,"a", tc);



CORBA::Object_ptr dafo = orb->resolve_initial_references("__");

DynamicAny::DynAnyFactory_var daf =
DynamicAny::DynAnyFactory::_narrow(dafo);

DynamicAny::DynAny_var dv = daf->create_dyn_any_from_type_code(tc_var);

The first string insertion is easy

dv->insert_string(_par.name());

dv->next();

//if the list type code creation is needed then

CORBA::TypeCode_var tc_list= orb->create_sequence_tc(0, tc_var );

tc_list = orb->create_alias_tc("IDL:c/*l*/*c*/*s*/alist:1.0","alist"
,tc_list);

CORBA::TypeCode_var tc_listlist= orb->create_sequence_tc(0, tc_list );

tc_listlist = orb->create_alias_tc("IDL:c/*l*/*c*/*s*/alistlist:1.0",
"alistlist",tc_listlist);



//after that dynamic arrays are created, the dynamic listlist is the same

DynamicAny::DynAny_var dv = daf->create_dyn_any_from_type_code(tc_list);

DynamicAny::DynSequence_var daSeq=DynamicAny::DynSequence::_narrow(dv);



DynamicAny::DynAny_var dv = daf->create_dyn_any_from_type_code(tc_listlist);

DynamicAny::DynSequence_var daSeq=DynamicAny::DynSequence::_narrow(dv);





//I wont list here the whole code, from these sequence an any type _any is
created, an that _any is put to

dv->insert_any(_any);

dv->next();

and the dv is filled with other values.



Finally the dv->to_any() is called and this is handed to the

req->add_in_arg("arguments") =



The problem is that in the ?request? not all the type code is listed only
for the tc_list one.

A chomped example from the log

4749 4f50 0102 0000 0000 0196 0000 0002 GIOP............

0300 0000 0000 5cdc 0000 0031 afab cb00 ......\....1....

0000 0020 8cb5 fb27 0000 0001 0000 0000 ... ...'........

0000 0001 0000 0008 526f 6f74 504f 4100 ........RootPOA.

0000 0008 0000 002d 0000 0000 14da 5e64 .......-......^d

0000 0009 6578 ffff ffff ffff 00da 5ed4 ....exec......^.

0000 0001 0000 0001 0000 000c 0000 0000 ................

0001 0001 0001 0109 0000 000f ffff ffff ............XXXX

ffff ffff ffff ffff ffff 0008 0000 0001 XXX.XXXXXX......

0000 0007 7661 6c75 6573 0078 0000 0013 ....values.x....

0000 00a4 00ff 0000 0000 0013 0000 0094 ................

00d7 0b20 0000 000f 0000 0084 00bf f598 ... ............

0000 0023 4944 4c3a ffff ffff ffff ffff ...#IDL:c/l/

ffff ffff ffff ffff ffff ffff ffff ffff c/s/a

ffff ffff ffff ffff 0000 000b ffff ffff :1.0.(....tc

ffff ffff ffff 0020 0000 0004 0000 0005 ............

6e61 6d65 0000 0001 0000 0012 0000 0000 n............

0000 0007 7661 6c75 655f 0065 0000 000b ....v.....

0000 0006 666c 6167 ff00 0007 0000 0003 ....f.......

0000 0008 6c65 6e67 ffff ff00 0000 0002 ....l.....

0000 0000 0000 0000 0000 0001 0000 0002 ................

0000 0004 ffff 5900 0000 00ff 0000 0000 ....K.........

0000 000a ffff 5fff ffff ffff ffff ffff ....B

0000 0000 0000 667c 0000 00ff ffff 4c55 ......f|....VALU

4500 66d0 0000 0012 0000 0000 0000 0002 E.f.............

3200 ffff 0000 0000 0000 ffff 0000 0000 ***@......gx....

0000 ..

To my opinion and this way is excepted from the ?server? side, all the

tc_listlist, tc_list and tc description/id should be visible in the logs,
and the server is answering that it cannot interpret the values.

My question is that how should I enforce that the description/id content to
be part of the request? What am I using wrong?

Thanks in advance

BR

PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20100517/f28250ec/attachment.htm
Loading...