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 "Sheptunov, Bogdan" <Bo...@experian.com> on 2004/11/22 22:16:24 UTC

hiding a property from Axis serializer?

Hello,

Axis serializer by default picks up everything that looks like a JavaBean property, and puts it into response. This leads to an undesirable side effect: some of the class internals that have bean-like access, become exposed to the outside and end up being automatically included into the Soap response. 

Is there a good way to avoid that, or to perhaps "hide" the properties of my choice from Axis, so that they would not be exposed automatically?

The effect I am seeing now is that some of my properties show up on the response object even if they are not declared in WSDL. How can this be?

I've look at org.apache.axis.description.TypeDesc, and thought of possibly removing a corresponding org.apache.axis.description.ElementDesc entity from there, but there's no any removal API. And the only ways to create org.apache.axis.description.TypeDesc() all require you to pass in a class (don't allow you to "build from scratch"), so you cannot really bulid the TypeDesc manually (so that I could only expose the properties I'd want).

Please advice.

Thanks
Bogdan

PS Axis 1.2 RC1. 

Re: hiding a property from Axis serializer?

Posted by to...@gsk.com.
I don't think there is any way of hiding properties explicitly. If you use 
a BeanSerializer, all properties that follow the JavaBean convention will 
be picked up. One way is to not use JavaBean conventions for those 
properties that you want to hide. Take a look at the JavaBean 
specification and see if you can modify the getter and setter methods for 
those properties so that they don't follow the convention. For example, if 
the methods don't need to be public, removing the public modifier, might 
do the trick.

If Axis made use of a BeanInfo class, you might be able to hide properties 
that way, but I think Axis just assumes the standard JavaBean conventions, 
without BeanInfo modification.

Otherwise, you'd probably have to write your own serializer (and you might 
still be able to use the BeanDeserializer at the other end).

Tony




"Sheptunov, Bogdan" <Bo...@experian.com> 
22-Nov-2004 21:16
 










Hello,

Axis serializer by default picks up everything that looks like a JavaBean 
property, and puts it into response. This leads to an undesirable side 
effect: some of the class internals that have bean-like access, become 
exposed to the outside and end up being automatically included into the 
Soap response. 

Is there a good way to avoid that, or to perhaps "hide" the properties of 
my choice from Axis, so that they would not be exposed automatically?

The effect I am seeing now is that some of my properties show up on the 
response object even if they are not declared in WSDL. How can this be?

I've look at org.apache.axis.description.TypeDesc, and thought of possibly 
removing a corresponding org.apache.axis.description.ElementDesc entity 
from there, but there's no any removal API. And the only ways to create 
org.apache.axis.description.TypeDesc() all require you to pass in a class 
(don't allow you to "build from scratch"), so you cannot really bulid the 
TypeDesc manually (so that I could only expose the properties I'd want).

Please advice.

Thanks
Bogdan

PS Axis 1.2 RC1.