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 Olivier Mocquais RD-BIZZ <ol...@francetelecom.com> on 2006/03/09 11:48:46 UTC
Wsdl2java and array generation
Hi,
I have a question about wsdl2java ant task of Axis
I have specified a complex type in a WSDL and used the wsdl2java to
generate the java class.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="intervention">
<xs:annotation>
<xs:documentation>Comment describing your root
element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="bloc">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="item">
<xs:complexType>
<xs:attribute name="valeur"
use="required"/>
<xs:attribute name="libelle"
use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="valeur"/>
<xs:attribute name="libelle" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
And after the generation, I have:
public class Intervention implements java.io.Serializable {
private generated.InterventionBloc bloc;
public Intervention() {}
... }
But I wanted a array of generated.InterventionBloc as I have specified
in the xml schema (with maxOccurs="unbounded")
private generated.InterventionBloc[] bloc;
Why it doesn't work ?
Thanks.
Olivier
Re: Wsdl2java and array generation
Posted by Dies Koper <di...@jp.fujitsu.com>.
Hello Olivier,
As far as I know Axis does not support the minOccurs/maxOccurs
attributes on sequence (I think it ignores them).
Please put them on element instead:
<xs:element name="bloc" minOccurs="1" maxOccurs="unbounded">
Regards,
Dies
Olivier Mocquais RD-BIZZ wrote:
> Hi,
>
> I have a question about wsdl2java ant task of Axis
>
> I have specified a complex type in a WSDL and used the wsdl2java to
> generate the java class.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:element name="intervention">
> <xs:annotation>
> <xs:documentation>Comment describing your root
> element</xs:documentation>
> </xs:annotation>
> <xs:complexType>
> <xs:sequence minOccurs="1" maxOccurs="unbounded">
> <xs:element name="bloc">
> <xs:complexType>
> <xs:sequence maxOccurs="unbounded">
> <xs:element name="item">
> <xs:complexType>
> <xs:attribute name="valeur"
> use="required"/>
> <xs:attribute name="libelle"
> use="required"/>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> <xs:attribute name="valeur"/>
> <xs:attribute name="libelle" use="required"/>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> And after the generation, I have:
> public class Intervention implements java.io.Serializable {
> private generated.InterventionBloc bloc;
> public Intervention() {}
> ... }
>
> But I wanted a array of generated.InterventionBloc as I have specified
> in the xml schema (with maxOccurs="unbounded")
> private generated.InterventionBloc[] bloc;
>
> Why it doesn't work ?
>
> Thanks.
>
> Olivier