[omniORB] Putting a Sequence into an Any and marshalling it

Gert Steenssens gsteenss@eps.agfa.be
Fri, 24 Jul 1998 17:08:53 +0200


Hi all,


I've encountered a little problem while trying to put an Unbounded Sequence into
an Any for marshalling over the network.
The piece of code to get it into the Any using the <<= operator seems to work
(or at least does not throw an exception), but when I actually want to send it
over the network, a system exception is throw during marshalling (I tried
tracing into the omniORB code, but it only seems to confuse me even more).

I guess there's something wrong with allocation of the sequence or the Any, and
the object gets deleted too soon, may I need to duplicate one of them? (and
how?). 
Both <<= operators (the one which needs a pointer, the other which needs a ref)
seems to have the same problem, although omniORB documentation states that one
of them copies the data, while the other take the pointer under its own control.

If I put a simple CORBA::Long into the Any, everything works fine and gets
marshalled across to the client.

Below is a sample of IDL I use.
The REASON for using a Any in the IDL is because I need to embed multi-level
dictionaries and can see another way of doing it, If someone out there knows
another/better way, please do tell me...

BTW.: I'm using omniORB 2.5.0 if that may help to locate the problem.


=== start of IDL ===

module Dict
{

enum DictionaryElementType { isBoolean, isInteger, isFloat, isString,
isDictionary };

union DictionaryValue switch(DictionaryElementType)
{
  case isBoolean:
   boolean boolVal;

  case isInteger:
   long i32Val;

  case isFloat:
   float floatVal;
  
  case isString:
   string strVal;
  
  case isDictionary:
   any dictVal;

  };

  struct DictionaryElement
  {
    string Key;
    DictionaryValue Value;
  };

  typedef sequence<DictionaryElement> Dictionary;
};


-- 

Gert Steenssens (3586)
gsteenss@eps.agfa.be

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

"The drum is the beating of the hart,
 The bass is the rhythm of the mind."

 - Lee 'Scratch' Perry, The Upsetter -