Hello.
Is there a simple way to choose the javabeans' attributes to display in the
WSDL.
for example, I have this bean :
public class Personn {
private String name, firstname, surname;
public String getName() { return name; }
public String getFirstname() { return firstname; }
public String getSurname() { return surname; }
public void setName(String s) { name = s; }
public void setFirstname(String s) { firstname = s; }
public void setSurname(String s) { surname = s; }
}
By default, the generated XML Schema generated in the wsdl is :
<complexType name="SMSText">
<sequence>
<element name="name" nillable="true" type="xsd:string" />
<element name="firstname" nillable="true" type="xsd:string" />
<element name="surname" nillable="true" type="xsd:string" />
</sequence>
</complexType>
How can I hide the surname, for example, in order to generate this Schema :
<complexType name="SMSText">
<sequence>
<element name="name" nillable="true" type="xsd:string" />
<element name="firstname" nillable="true" type="xsd:string" />
</sequence>
</complexType>
I searched a lot (in the Axis source) and tried several ways :
- using a BeanInfo : that didn't work. The BeanSerializer doesn't use the
java.bean.Introspector
- writing a getAttribute() method in the bean : didn't work. This feature
doesn't seems to be used anymore : the method is called in the
BeanSerializer.getBeanAttributes(Class, TypeDesc) but getBeanAttributes is
not used in the BeanSerializer.writeSchema(Types) which is responsible for
the WSDL generation
- writing a getTypeDesc() methode in the bean : didn't work. I thaught the
TypeDesc was used to describe a class, but It's the ClassRep object that is
used to Introspect the Bean classes. I haven't understood what the TypeDesc
is used for ... :(
The only way I see is to write an other BeanSerializer (hard to do ...) or
to extend the addFields(Class) method of ClassRep, but I don't know how to
make the AxisServlet use my version of ClassRep for the dynamic generation
of the wsdl (with the ?wsdl in the URL).
Any help will be greatly appreciated.
- C�dric
PS : excuse my poor english : I'm French and not used to write English ...
;(