Another deserialization issue: I had problems deserializing an
inherited boolean property.

Details: My class Foo extends Bar which extends something etc, and in
the top level class there is a property isNew with matching "private
boolean is_new".

The deserialization strategy in Axis doesn't work - I get a SAXException

JavaUtils.getMessage("badElem00", javaType.getName(),
               localName));

message (which I don't get anymore, hence the code and not the message:)

This seemed weird to me, as my code was in accordance with the Beans
Specification (page 57 and 58) so I tried some of my own code and now it
works. My fix (which works for me but may not be appropriate for
everybody, i.e. for the axis source) was adding the following check
before throwing SAXException:


        if( propDesc == null ) {
                // Why? Let me try the standard way:
                try {
                                String mylocal = java.beans.Introspector.decapitalize( 
localName );
                java.beans.PropertyDescriptor[] pd =
java.beans.Introspector.getBeanInfo( javaType ).getPropertyDescriptors();
                for( int i = 0; i < pd.length; i++ )
                        if( pd[i].getName().equals( mylocal ) )
                                propDesc = new BeanPropertyDescriptor( pd[i].getName(),
pd[i].getReadMethod(), pd[i].getWriteMethod() );
               } catch( java.beans.IntrospectionException myex ) {
                // Ignore - but now we're doomed. SAXException coming up.
              }
        }


(on line 206 in BeanDeserializer.onStartChild(...) from the beta2
distribution).


While this may not be the best solution, I don't see why deserializing 
my boolean property shouldn't work. I don't understand much of the
serialization and deserialization going on in Axis, but it seems very
complicated. Is this a bug, a missing feature, or me missing something?
Is it because of a missing call to java.beans.Introspector.decapitalize?

Anyway, this check works for me. Let me know if anybody has better 
solutions or more information (by mail or by the mailing list).


And for anybody interested in Torque: This problem arose because I use 
Torque-generated classes in my web service. So with my two fixes Torque 
and Axis now works properly together.


Regards,


Narve


Reply via email to