You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by David Kenzik <da...@kenzik.com> on 2001/09/15 23:06:40 UTC

Integer[] Casting Problem

Hello all.

Apache SOAP has been working out well for me and my current project. Seems
that it works pretty-much as documented, and where it doesn't, it's pretty
easy to go in and repair.

Before I look further into this, I'd like to ask about a service's method
returning an "Integer[]" (it might effect all "Object[]" mappings, but I
haven't testing anything but.)

As I said, my service's method returns an Integer[]. In my client, when
trying to cast the Object from getReturnValue().getValue() to an
"Integer[]", I get an Exception:

	java.lang.ClassCastException: [I

(That isn't a typo, it only returns "[I".)

If I cast the Object into an "int[]", it works fine (even though the service
is returning an "Integer[]".)

Now this might not seem like that big of a deal, but I'm documenting a SOAP
interface to an application server I've written, and it calls for said
Integer[] to be an Object value in a Hashtable. It's just a bit strange (and
I think improper) if it's not preserved.

Is this a known issue? Am I doing something wrong?

Thank you for any input on this.

-- 
David S. Kenzik
david@kenzik.com -  http://kenzik.com
Original Music   -  http://kenzik.com/music

Re: Integer[] Casting Problem

Posted by Michael Betzel <m....@morgenundmorgen.de>.
David Kenzik wrote:

>Hello all.
>
>Apache SOAP has been working out well for me and my current project. Seems
>that it works pretty-much as documented, and where it doesn't, it's pretty
>easy to go in and repair.
>
>Before I look further into this, I'd like to ask about a service's method
>returning an "Integer[]" (it might effect all "Object[]" mappings, but I
>haven't testing anything but.)
>
>As I said, my service's method returns an Integer[]. In my client, when
>trying to cast the Object from getReturnValue().getValue() to an
>"Integer[]", I get an Exception:
>
>	java.lang.ClassCastException: [I
>
>(That isn't a typo, it only returns "[I".)
>
>If I cast the Object into an "int[]", it works fine (even though the service
>is returning an "Integer[]".)
>
>Now this might not seem like that big of a deal, but I'm documenting a SOAP
>interface to an application server I've written, and it calls for said
>Integer[] to be an Object value in a Hashtable. It's just a bit strange (and
>I think improper) if it's not preserved.
>
>Is this a known issue? Am I doing something wrong?
>
>Thank you for any input on this.
>
hello david,


i've tried to serialize an array of Doubles and ended up with the same 
problem.
the service serializes an array of Double[] the same way as an array of 
double[]:  

... ns2:arrayType="xsd:double[5]"..

as long as the service makes no difference in serializing arrays of 
'plain' and 'wrapped'
number types the deserializer will be fixed to just one kind of 
deserialization.

an array of integers is represented by a reference type, so the 
deserializer does
not really need the wrapping class to return an object.

just go on working with an array of wrapped integers on the service side 
if you need this,
and prepare the client to expect an array of 'plain' integers.

mischa



Re: Integer[] Casting Problem

Posted by Michael Betzel <m....@morgenundmorgen.de>.
David Kenzik wrote:

>Hello all.
>
>Apache SOAP has been working out well for me and my current project. Seems
>that it works pretty-much as documented, and where it doesn't, it's pretty
>easy to go in and repair.
>
>Before I look further into this, I'd like to ask about a service's method
>returning an "Integer[]" (it might effect all "Object[]" mappings, but I
>haven't testing anything but.)
>
>As I said, my service's method returns an Integer[]. In my client, when
>trying to cast the Object from getReturnValue().getValue() to an
>"Integer[]", I get an Exception:
>
>	java.lang.ClassCastException: [I
>
>(That isn't a typo, it only returns "[I".)
>
>If I cast the Object into an "int[]", it works fine (even though the service
>is returning an "Integer[]".)
>
>Now this might not seem like that big of a deal, but I'm documenting a SOAP
>interface to an application server I've written, and it calls for said
>Integer[] to be an Object value in a Hashtable. It's just a bit strange (and
>I think improper) if it's not preserved.
>
>Is this a known issue? Am I doing something wrong?
>
>Thank you for any input on this.
>
hello david,


i've tried to serialize an array of Doubles and ended up with the same 
problem.
the service serializes an array of Double[] the same way as an array of 
double[]:  

... ns2:arrayType="xsd:double[5]"..

as long as the service makes no difference in serializing arrays of 
'plain' and 'wrapped'
number types the deserializer will be fixed to just one kind of 
deserialization.

an array of integers is represented by a reference type, so the 
deserializer does
not really need the wrapping class to return an object.

just go on working with an array of wrapped integers on the service side 
if you need this,
and prepare the client to expect an array of 'plain' integers.

mischa