You need a class which extends java.beans.SimpleBeanInfo.
Say you have a bean called SpecialData and it has some properties you do not
want to be introspected and generated into the resulting Web Service Type
Description.  You would then create another class extending the
SimpleBeanInfo, SpecalDataBeanInfo and place it in the same package as the
SpecialData class.  In your extened bean info class you would then need to
override the public PropertyDescriptor[] getPropertyDescriptors() method.
By default this will return an array of all the properties in the bean.  You
can do a couple of different things here.  1 you can retrieve all the
property descriptors as it would be default then remove from the array the
properties you do not want returned.  The other option is to simply create
the propery descriptor list yourself in this method and return it.

1-1:     {
1-1:         PropertyDescriptor descriptors[] = null;
1-1:
1-1:         if(beanClass != null)
1-1:         {   // Introspect the specified class get descriptors
1-1:             try
1-1:             {
1-1:                 BeanInfo beanInfo =
Introspector.getBeanInfo(beanClass);
1-1:                 descriptors = beanInfo.getPropertyDescriptors();
1-1:             }
1-1:             catch (IntrospectionException e)
1-1:             {
1-1:                 descriptors = new PropertyDescriptor[0];
1-1:             }
1-1:         }
1-1:         else
1-1:         {
1-1:             descriptors = super.getPropertyDescriptors();
1-1:         }
1-1:
1-1:         return descriptors;
1-1:     }


The downside to creating the list yourself is that when new properties are
added that you want to have returned you would need to add them here as
well.

Let me know if this helps any.



-----Original Message-----
From: Sheptunov, Bogdan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 30, 2004 9:49 AM
To: [EMAIL PROTECTED]
Subject: RE: hiding a property from Axis serializer?


Could you please elaborate a little more on that? In what way exactly? Have
my class implement BeanInfo interface and describe the properties I'd like
to see returned in getPropertyDescriptors() method? 

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 30, 2004 11:40 AM
> To: [EMAIL PROTECTED]
> Subject: RE: hiding a property from Axis serializer?
> 
> 
> Try using the bean info class to define what properties exist
> for the bean.
> Axis seems to obey this Java Bean rule.
> 
> -----Original Message-----
> From: Sheptunov, Bogdan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 23, 2004 11:57 AM
> To: [EMAIL PROTECTED]
> Subject: RE: hiding a property from Axis serializer?
> 
> 
> >   A "filter all those properties" approach is to create a interface 
> > for each of those beans you would like to serialize, but just 
> > including getters and setters for those properties you really want 
> > to be serialized; then let your bean implement that interface
> > (already does!) 
> > and alter all your web services to not use the bean class but the 
> > "filtered inteface".  The main drawback (and innaceptable 
> for me) is
> 
> I already tried that. Defined an interface, had a class (that
> has some other
> properties besides the one declared in the bean interface) 
> implement it, put
> the interface name in WSDD file. Axis ended up putting all of 
> the properties
> (not only the ones defined in WSDD) into the response object 
> anyway. This
> looks like a bug to me. Shouldn't only the properties listed 
> in the WSDL be
> serialized?
> 
> Ideas anyone?
> 
> Bogdan
> 

Reply via email to