[omniORB] Problem (Bug?) with DynAny
Mike Ladwig
mike@twinpeaks.prc.com
Wed, 26 May 1999 09:15:43 -0400
Hi. I'm having a problem with DynAny. What I want to do is parse the
contents of an Any containing an unbounded string sequence. The test
code works fine if the Any is encoded and decoded in the same process,
but when the Any is encoded in one place and decoded elsewhere, the
get_string() call throws a TypeMismatch exception. Everything else (the
type codes and length) are all being extracted correctly - only
get_string() fails.
I'm running omniORB 2.7.1 with patches 52 and 57 applied.
Thanks for any help
mike.
My test code:
stringSeq keys; // IDL: typedef sequence<string> stringSeq
keys.length(3);
keys[0] = CORBA::string_dup("string 1");
keys[1] = CORBA::string_dup("string 22");
keys[2] = CORBA::string_dup("string 333");
CORBA::Any foo;
foo <<= keys;
// ********** The dividing line (code works unless the any goes over the wire)
CORBA::DynAny_ptr da = theOrb->create_dyn_any( foo );
CORBA::DynSequence_ptr da_seq = CORBA::DynSequence::_narrow(da);
cerr << "MDL>>> da length'" << da_seq->length() << "'" << endl;
for( CORBA::ULong i = 0; i< da_seq->length(); i++ )
{
CORBA::String_var v;
try { v = da_seq->get_string(); }
catch( CORBA::DynAny::TypeMismatch &tm )
{
cerr << "Caught a TypeMismatch" << endl;
}
cerr << "MDL>>> da i'" << i << "' v='" << v << "'" << endl;
}