Hello,
I'm working with XFire 1.2.6, on a Java 1.4 / WebSphere 6.0.2.17 platform. I
would like to know if it is possible to modify the XFire serializing behaviour
for Java Objects containing element of type List.
Currently, when a Java class is containing an attribute ABC of type List, this
attribute is interpreted as an element of type ArrayOfABC, containing a
sequence of elements of type XYZ (define in an *.aegis.xml file). I want to
modify this behaviour in order to make XFire interpreting this attribute ABC as
an element of type XYZ that can occurs N times.
If it is not a configuration issue, just tell me if it is possible to modify
the code of the component in charge of generating the XML Shemas and
serializing the Java Objects (I think it is Aegis).
You can read the example below if you want to have a practical approach on what
I would like to do:
Imagine a WebService exposing the method: public InformationsProfessionnelles
getInfoPerso()
The type InformationsProfessionnelles is a Java bean class:
public class InformationsProfessionnelles {
private String matricule;
private List affectation;
public List getAffectation() {
return affectation;
}
public void setAffectation(List affectation) {
this.affectation = affectation;
}
public String getMatricule() {
return matricule;
}
public void setMatricule(String matricule) {
this.matricule = matricule;
}
}
The attribute affectation is a List of instances of class Affectation, which is
a Java bean class:
public class Affectation {
private String codeUnite;
private String codeAffectationPrincipale;
public String getCodeAffectationPrincipale() {
return codeAffectationPrincipale;
}
public void setCodeAffectationPrincipale(String
codeAffectationPrincipale) {
this.codeAffectationPrincipale =
codeAffectationPrincipale;
}
public String getCodeUnite() {
return codeUnite;
}
public void setCodeUnite(String codeUnite) {
this.codeUnite = codeUnite;
}
}
The XML Schema corresponding to the type InformationsProfessionnelles,
generated by XFire in the WSDL, is:
<xsd:complexType name="InformationsProfessionnelles">
<xsd:sequence>
<xsd:element minOccurs="0" name="affectation"
nillable="true" type="ns1:ArrayOfAffectationType" />
<xsd:element minOccurs="0" name="matricule"
nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfAffectationType">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="AffectationType" nillable="true"
type="ns1:TypeAffectationType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TypeAffectationType">
<xsd:sequence>
<xsd:element minOccurs="0"
name="codeAffectationPrincipale" nillable="true"
type="xsd:string" />
<xsd:element minOccurs="0" name="codeUnite"
nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
In this schema, you can see that XFire transform the property affectation in an
element of type ArrayOfAffectationType, instead of making it as an element of
type TypeAffectationType, that have a maxOccurs attribute set to unbounded.
So, instead of having the XML Schema above, I would like to obtain the
following:
<xsd:complexType name="InformationsProfessionnelles">
<xsd:sequence>
<xsd:element minOccurs="0" name="Matricule"
type="xsd:string" />
<xsd:element minOccurs="0" name="Affectation"
type="AffectationType" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="AffectationType">
<xsd:sequence>
<xsd:element name="CodeUnite" type="xsd:string" />
<xsd:element name="CodeAffectationPrincipale"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
Thanks in advance.
Regards,
Loïc CHAUVET
Consultant
Fixe : +33 (0) 1 49 03 22 17
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Dreamsoft - solucom group
Tour Franklin - 100-101 terrasse Boieldieu
92042 Paris La Défense cedex