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 JP Fielding <fi...@asset.com> on 2002/06/27 03:11:50 UTC
bean serialization issue
i apoligize if this question has already been asked as i am new to this list and didn't see this question in the archives...
i wrote a service that uses a simple bean class. declared it a service in the wsdd. listed the bean mapping in the wsdd. i invoked the client tools to generate proxies based on the generated wsdl file for the service.
for the absolute classic bean, this works like a charm. even for very complex hierarchies of 'classic' beans (that is to say the property name has a corresponding attribute of the same name (and case!)
public class Service{
public void grind( Bean bean ){}
}
class Bean{
private String name= null;
public String getName(){ return name; }
public void setName( String name ){ this.name = name; }
}
however.... for any bean that does not follow that pattern exactly...
class Bean{
public String getName(){ return "";}
public void setName( String name ){}
}
or
class Bean{
private String _name = null;
public String getName(){ return _name;}
public void setName( String name ){ this._name = name; }
}
NOT AS CHARMING :-(, the client proxy generation does not work ( because the wsdl generation is different)...
for my case, i was using aspectj to apply mixins to provide widely used properties...
interface Nameable{
static aspect BODY{
private String Nameable.name= null;
public String Nameable.getName(){ return name; }
public void Nameable.setName( String name ){ this.name = name; }
}
}
class Bean implements Nameable{}
when aspectj introduces the name variable, it provides a namespaced name that is NOT 'name'. so in this case i must go into client generated proxy classes and 'adjust' the files to work with what i've generated.
note this case would not de/serialize if you had calculated fields, as in the proverbial point class, for example
class Point{
private int x = 0;
private int y = 0;
public int getPi(){ // calc pi from x and y }
public void setPi( int pi ){ // calc x and y from pi }
public int getRadius(){ // calc pi from x and y }
public void setRadius(){ // calc x and y from pi }
}
so basically, why should the wsdl bean representation care whether my bean is backed by an attribute, a calculation or even no-op. so long as the interface is a bean, should there be a difference? i thought the definition of a bean was based on 'properties' not 'attributes'.
does anyone know of similar issues? is this a bug or a feature?
thanks for your time on this lengthy email.
JP Fielding
Software Engineer - SAIC Morgantown
Work: (304) 284-9000
Mobile: (304) 685-1744
E-Mail: fielding@asset.com
MSIM: fielding@asset.com
AIM: jpfieldingSAIC