axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Gmane <>
Subject Re: exposing only parts of a Java Bean
Date Thu, 25 Nov 2004 19:22:42 GMT

After reading the JavaBeans spec again, you are right a bean property 
can be read-only in which case only the get() method needs to appear or 
it can be write-only in which case only the set() method needs to 
appear, so Axis is doing the right thing exposing these properties that 
don't have both get/set methods.

Anyway, assuming that I can get a custom serializer to do what I want, 
will it solve the Java2WSDL problem? Will the tool use my custom 
serializers to determine what properties to expose or will it still 
expose all bean properties and I would have to edit the WSDL by hand 
which is not an option because I am generating it many times a day and 
it's pretty long and complicated.

It would be too nice for Axis to support BeanInfo :)

Thanks for your help.

Tim wrote:
> The only other "simple" thing I can think of is, instead of using an 
> interface, as you've tried, use a wrapper class. If the service returns 
> the wrapper object, that only exposes the attributes you want, but wraps 
> the real object, then Axis will only serialize the properties you want 
> serialized. If the wrapper was a subclass of the original class and 
> delegated to the original object, then it wouldn't be too difficult, no 
> WSDL changes needed and no need for the wrapper class on the other side.
> Or you could write your own serializer (using the BeanDeserializer for 
> deserializing). It's a bit tedious but it might be worth the exercise.
> Tony
> Tim wrote on 24/11/2004 16:23:56:
>  >  <tony.q.weddle <at>> writes:
>  >
>  > >
>  > >
>  > > Just a couple of point on this.
>  > > The JavaBean specification does not requite
>  > > a getter and setter for each property. A get method implies a readable
>  > > property (in Axis terms, it means that property can be serialised). 
> A set
>  > > method implies a modifiable property (in Axis terms, it means the 
> property
>  > > can be deserialised).
>  > > Simon mentioned a special constructor on BeanSerializer
>  > > and BeanDeserializer. If this can be used to do what Tim wants, only
>  > BeanSerializerFactory
>  > > and BeanDeserializerFactory subclasses would be needed, to create the
>  > appropriate
>  > > instance, and specified in the mapping. However, a quick scan of the
>  > BeanDeserializer
>  > > indicates that it might not do the job - sorry, if I've got that wrong.
>  > > Tony
>  > >
>  >
>  > And I assume Axis does not care about a BeanInfo, does it?
>  >
>  > So is there a way to achieve what I need short of renaming the getXXX 
> and
>  > setYYY methods to something else which in some cases is not even 
> possible
>  > (e.g. I have a CusomException which overrides the 
> Throwable.getMessage(), now
>  > I end up with a getMessage1() method and a "message1" element in the 
> complex
>  > type in the WSDL which I do not want or need, and renaming the method
>  > getMessage() in my CustomException is not an option in this case).
>  >
>  > I think Axis really needs a descriptor of some sort that let's the 
> user pick
>  > and choose what's being exposed.
>  >
>  > Thank you,
>  >
>  > Tim

View raw message