axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Haddad" <chris.had...@cobia.net>
Subject RE: how to choose bean attributes to publish in WSDL
Date Thu, 11 Apr 2002 17:21:33 GMT
Cedric - 

Using a nightly build, accessor methods that are defined with a private
or protected scope are not exposed in the WSDL.

This is when the WSDL is generated via /axis/services/<serviceName>?wsdl
and Java2WSDL.

Cheers,

/Chris

-----Original Message-----
From: Benazech Cédric [mailto:Cedric.Benazech@atosorigin.com] 
Sent: Thursday, April 11, 2002 11:58 AM
To: axis-dev@xml.apache.org
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
...
;(




Mime
View raw message