You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Navneet Joneja <nj...@interwoven.com> on 2003/02/11 01:28:46 UTC

Deserializing an JavaBean with a property that is an array of Jav aBeans

Hi,
I'm using AXIS 1.1 beta to consume a published webservice that returns a
structure that contains an array of beans.
 
I ran Java2WSDL on the WSDL and the service would not work (Something about
a SAXException - unexpected "item"). So I looked at the Bean generated for
the parent structure. The type metadata for the field which was supposed to
be an array actually said the type was just the basic type.
So if I had
 
public class Moo {
     public Cow[] getCows()
}
 
The type metadata was set to Cow, not Cow[].
 
So I changed the metadata to ArrayOfCow instead of Cow, and voila! it
worked.
 
 
After running AXIS in my trusty debugger I traced the problem to the
following lines in JavaBeanHelperWriter:
(lines 274 - 283) that were dropping the array information. The comment is
somewhat ironic ;-)
 
// Some special handling for arrays
TypeEntry elemType = elem.getType();
while (elemType.getRefType() != null) {
    elemType = elemType.getRefType();
}
QName xmlType = elemType.getQName();
if (xmlType != null && xmlType.getLocalPart().indexOf("[") > 0) {
    // Skip array types, because they are special
    xmlType = null;
}
 
So my questions are:
1. Why is array information being dropped?
2. If I remove this code, will it have any adverse side effects (e.g. for
simple types, etc)
3. Is this a known bug and is someone working on it?
4. When is a final release of 1.1 expected?
 
Many thanks,
- Navneet