Array of Arrays in wM61

Hi,

I am attempting to use the COM services in the WmWin32 package in
wm6.1 to call a COM function that takes the following as its
arguments:

comFunction1( string a, string b, string c, string d)

The service WmWin32/win32.COM.dispatch:invoke requires an object
array of the above parameters to be passed in order to call the
COM function.

I am running into problems when I create the object array since
I cannot create an array inside an array.

Ideally what I would have is:
ObjArray
-> string a
-> string b
-> stirng c
-> string d

webMethods seems to handle the strings ‘a’ and ‘d’ within the
object array well, but not the string arrays ‘b’ and ‘c’.

Has anyone else run into this problem or has some advice
to overcome this issue?

Thanks.

Hello Mike,

It happens to be Java and not webMethods that has the issue. To have the inner arrays, you would need ObjArray to have this signature:
String ObjArray

And then string a and string b would need signature:
string a
string b

All together you would need to have arrays.

You can mix the dimensions of the arrays, but the all need to have the same signature.

Hello Mike,

I put a foot in my mouth. You can do this:

Object a = new String(“a”);
Object b = new String{“b”,“B”};
Object c = new String{“c”,“C”};
Object d = new String(“d”);
Object ObjArray = new Object{a, b, c, d};

I have done this before and is infact this how WM works with its Object data types when you are working in a Java Service (Which is the reason you have to cast IDataCursor.getValue()).

The previous post was if the input parameter had to be type String.

Hi Yemi,

I gave your suggestion a shot. However, I seem to come across the same problem that I had in my orignal scenario when I inspect the pipeline.

That is, if I look at the values of ‘b’ and ‘c’ in your above code in the ObjArray, I see “[Ljava.lang.String;@1c86820” and “[Ljava.lang.String;@2c4842” instead of the values that were assigned to them. Is this as designed?

Thanks for your help

Hello,
Yes this is fine, when you view arrays in java, they display there Memory address. To see there contents, you will have to loop over the arrays individually. If you make a java service to output the array, then make a flow service to contain this java service and hand map each element to there WM types (String, String List, String List, String). When you look at the pipeline after that operation, you should see all your values. So to recap:
Flow service{
java service - generate the COM array
map - pull out each element to their respective type
}
Good luck.

I looped through the Object Arrays contents just as you suggested and found all the values to be there

Thanks for your help Yemi.