Hi Bernard,

Bernard Marcelly wrote:
Hello,
While struggling to call a script from another script I found some oddities.

From Dev'Guide 18.5.2 "Implementing the XScript interface", I have extracted this code:

    public Object invoke( Object[] aParams,
                          short[][] aOutParamIndex,
                          Object[][] aOutParam )

This definition is not consistent with the (unpublished) IDL com.sun.start.script.provider.XScript :

invoke( [in] sequence< any > aParams, [out] sequence< short > aOutParamIndex, [out] sequence< any > aOutParam )

If you call a script from Javascript you have to invoke like this:

args = new Array(1);
args[0] = "Hello";
a = new Array( new Array() );
b = new Array( new Array() );
xScript.invoke(args, a, b);

This means that Dev'Guide definition was implemented.
So, were is the error ? In the Dev'Guide and in Javascript implementation ? In the IDL definition ? I would think the IDL is correct because there is no need of sequence of sequence.

your problem is probably quite simple. you extracted the code from a Java example where you see the mapped types from IDL. In the IDL file you see the corresponding IDL types. An out parameter is mapped to an array of length 1, a sequence is mapped to an array generally and an any is mapped to Java Object.

For example:
IDL:
[out] sequence<any>

is mapped to Java:
Object[][]

I hope this helps and everything is ok.


Another extract from Dev'Guide 18.5.2 :

        // Initialise the out paramters - not used at the moment
        aOutParamIndex[0] = new short[0];
        aOutParam[0] = new Object[0];

Does it mean that transmission of out parameters is not yet implemented ?
I suspect this because I could not retrieve anything after an Invoke from Javascript or from BeanShell. If this is not implemented, it should be written clearly in the IDL description.

out parameters working fine, you simply have to initialize the array and an array with the length of 0 is fine.

Juergen


Regards
   Bernard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to