This is at least the second time this subtle thing has caught me.
When allocating the array, the code is allocating slots for the entries to be placed there, but does not allocate the objects themselves. So the code:
out.mRefs = new customStepMethod$out.mRefs[3];
doesn’t give 3 mRefs objects, it gives an array with 3 slots for mRefs objects. What makes things more confusing is the fact that common string arrays imply that objects are allocated:
String list[] = new String[4];
list[0] = "abc";
list[1] = "def";
works but in fact we’ve actually instantiated 2 new String objects and placed references for them within the array slots. So we must do the same for any other object. This code should do the trick:
out.mRefs = new customStepMethod$out.mRefs[3];
for(int i=0; i<out.mRefs.length; i++)
{
out.mRefs = new customStepMethod$out.mRefs();
}
out.mRefs[0].mref_num = "100";
out.mRefs[1].mref_num = "200";
out.mRefs[2].mref_num = "300";#webMethods#Universal-Messaging-Broker#Integration-Server-and-ESB#broker