axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Filippenko" <Ivan.V.Filippe...@aero.org>
Subject RE: BeanSerializer bug (WAS: rc1 serializes fields with public getters butno setters)
Date Tue, 10 Sep 2002 15:01:04 GMT
> I saw the same behavior on bean properties with only getter methods.
> How to configure WSDD file to disable those fields?
> I didn't find any documentation for doing this.

Indeed!  How does one do this, please?

  -- Ivan





"Jianliang Zhao" <jzhao@zaplet.com>
09/09/2002 05:33 PM
Please respond to axis-user

 
        To:     <axis-user@xml.apache.org>
        cc: 
        Subject:        RE: BeanSerializer bug (WAS: rc1 serializes fields with public getters
but 
no setters)


I saw the same behavior on bean properties with only getter methods. How 
to configure WSDD file to disable those fields? I didn't find any 
documentation for doing this.
-----Original Message-----
From: Navneet Joneja [mailto:njoneja@interwoven.com]
Sent: Monday, September 09, 2002 5:29 PM
To: 'axis-user@xml.apache.org'
Cc: 'axis-dev@xml.apache.org'
Subject: RE: BeanSerializer bug (WAS: rc1 serializes fields with public getters 
but no setters)

Ivan,
I agree - I think there is a bug in the BeanSerializer, but not quite in 
the way you describe.
 
First - the solution to your problem - I believe that if you want to NOT 
serialize the field, I believe you could change the wsdd file so that this 
field does not get serialized.
 
As a matter of fact, I think the fact that the BeanSerializer does not 
deserialize beans (information based off beta 3, so if this has changed, I 
apologise) without a public setter method is a bug. This prevents you from 
making an object immutable AFTER deserialization. Compare the behavior of 
the BeanSerializer with the Java Serialization mechanism which serializes 
EVERYTHING except transient fields. The BeanSerializer should be able to 
do the same.
 
As an illustrative example, consider the following interface:
 
public interface AccountService extends java.rmi.Remote {
    public AccountData getAccountData();
    // other methods
}
 
class AccountData  {
    float balance;
    public float getBalance() {
        return balance;
   }
 
    private void setBalance(float balance) {
        this.balance=balance;
    }
 
    //other bean properties
}
 
So basically this interface wants to return all the information about the 
account as a single object to reduce granularity - the AccountData object.
Now the AccountData should be immutable once deserialized. Setting the 
value of, say, the balance attribute of the bean on the client side will 
have no effect and its presence in the public API would only serve to 
confuse users.
 
BeanSerializer should be able to handle such classes correctly but alas, 
does not. 
 
- Navneet
 
 -----Original Message-----
From: Ivan Filippenko [mailto:Ivan.V.Filippenko@aero.org]
Sent: Monday, September 09, 2002 4:23 PM
To: axis-user@xml.apache.org
Subject: rc1 serializes fields with public getters but no setters


This is new and annoying.  If I have a public method getURL() 
but no corresponding setter (and no instance variable, either), 
AXIS rc1 creates a <URL> field in the XML serialization.  But I 
don't want this field, because there are no provisions to deserialize it! 

This is new since Beta3, and looks like a bug, no? 

Thanks, 

  -- Ivan 


Mime
View raw message