If you're using the bean-serializer you could always change the get/set
method signature of the getSurname to avoid the get/set pattern :-)

Honestly, that's the solution I found. Since probably surname is a derived
value, you don't want it in the WSDL. I wish I could specify it, but I
haven't found out. Send me a note if you find out :-)

It seems to me like you have to write a custom serializer for now :-)

Kristian

----- Original Message -----
From: "Benazech Cédric" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 11, 2002 5:58 PM
Subject: how to choose bean attributes to publish in WSDL


> 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 ...
> ;(
>

Reply via email to