sorry, i just found that althought i can not cast the return value to
String[],
but i can cast it to Object[].
it's the array's element type that causing the ClassCastException.

On 9/22/06, June Fang <[EMAIL PROTECTED]> wrote:

i am new to xmlrpc, and i found that if i want to return an array from
the server
side, the client side's return value will be an Object, not Object[].
of course the actually type of the return value is an Object[], but
java just does
not allow you to cast it back to an Object[]. (it throws an
ClassCastException).
So if i use dynamic client proxy, it result in a CCE;
and if i use XmlRpcClient, i still can not cast the return value as below:
String[] result = (String[]) client.execute(...);
instead, i have to use reflection to operate on the return value.
Is there any better solution?
or could this be build into the framework? that's, the framework just
return an
array as Object if it find the actual type is an array.
BTW: xmlrpc's parser interface's getResult() method just return an plain
Object,
but i found the following code snip works under JDK 5.0:
Object returnArray() { return new String[]; }
String[] result = (String[]) returnArray();
is it possible that the paser return either a object, or an array,
depend on the actual
type of the result using reflection, as Object like the example above?


--
June Fang




--
June Fang

Reply via email to