How do I use CORBA.Any?

I'm trying to pass an Any into an auto-generated class-helper method. I know that the ORB is properly configured, because I can make the program work, if I lobotomize the function that I need.

ie:Any a = orb.create_any();

Record Id = RecordHelper.extract(a);

The extract sends the Any's input stream into another method that reads the stream's data(a char array and an int) and inserts it into the desired class, it then returns the class. Thus it falls to me to make it so that my Any has 2 variables carried inside it, a char array and an int. Sadly, whenever I use:

a.insert_long(643);

a.insert_string("A 64 character char array.............................................");

it will throw a Marshall exception 999 and die at the read long. Any ideas as to how I can configure my Any so that both variables can be accessed? Thank you.

Phil

ie

In InterfaceHelper

public static Interface.Record extract (org.omg.CORBA.Any a)

{

return read (a.create_input_stream ());

}

public static Interface.Record read (org.omg.CORBA.portable.InputStream istream)

{

Interface.Record value = new Interface.Record ();

value.Dac_Type = String_Definition.String_64Helper.read (istream);

value.Index = istream.read_long ();

return value;

}

In String_Definition.String_64Helper

public static char[] read (org.omg.CORBA.portable.InputStream istream)

{

char value[] = null;

value = new char[String_Definition.Size_64.value];

for (int _o0 = 0;_o0 < (String_Definition.Size_64.value); ++_o0)

{

value[_o0] = istream.read_char ();

}

return value;

}

[1735 byte] By [s824309] at [2007-9-26 4:46:31]
# 1
I think you should try creating an IDL struct that represents your char array and your int, populate this and put it in the any.
swatdba at 2007-6-29 18:35:46 > top of Java-index,Core,Core APIs...