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 iksrazal <ik...@gmail.com> on 2005/12/14 19:52:23 UTC
doc / lit array of complexType ?
Hi all,
I've used 'rpc encoded' arrays a lot but now I'm trying to migrate the concept
to doc / lit. Here's what I mean in 'rpc encoded' style :
<complexType name="ReturnWeb_AdminResellerListNewsCentres">
<complexContent>
<extension base="tns:ReturnWeb_Base">
<sequence>
<element name="list"
type="tns:ArrayOfReturnWeb_AdminResellerListNewsCentres_Item"/></sequence></extension></complexContent></complexType>
<complexType name="ArrayOfReturnWeb_AdminResellerListNewsCentres_Item">
<complexContent>
<restriction base="soap11-enc:Array">
<attribute ref="soap11-enc:arrayType"
wsdl:arrayType="tns:ReturnWeb_AdminResellerListNewsCentres_Item[]"/></restriction></complexContent></complexType>
<complexType name="ReturnWeb_AdminResellerListNewsCentres_Item">
<sequence>
<element name="news_id" type="int"/>
<element name="call_centre_id" type="int"/>
<element name="call_centre_name"
type="string"/></sequence></complexType>
That allows me to do a conversion like so:
ReturnWeb_AdminResellerListNewsCentres result = new
ReturnWeb_AdminResellerListNewsCentres();
java.util.List list = new ArrayList();
// db result set - just an example
while (rs.next()) {
ReturnWeb_AdminResellerListNewsCentres_Item item =
new ReturnWeb_AdminResellerListNewsCentres_Item(
rs.getInt("news_id"),
rs.getInt("call_centre_id"),
rs.getString("call_centre_name")
);
list.add(item);
}
rs.close();
ReturnWeb_AdminResellerListNewsCentres_Item[] list_array = new
ReturnWeb_AdminResellerListNewsCentres_Item[0];
list_array = (ReturnWeb_AdminResellerListNewsCentres_Item[])
list.toArray(list_array);
result.setList(list_array);
Sorry for the long example.
Now I'm trying to do the same with doc / lit and I believe, minOccurs and
maxOccurs:
<!-- shown for completeness -->
<complexType name="ReturnWebBase">
<sequence>
<element name="errorMessage" type="xsd:string"/>
<element name="successErrorCode" type="xsd:int"/>
</sequence>
</complexType>
<element name="ReturnWeb_AdminResellerListNewsCentres" minOccurs="0"
maxOccurs="unbounded">
<complexType>
<complexContent>
<extension base="tns:ReturnWebBase">
<sequence>
<element name="news_id" type="int"/>
<element name="call_centre_id" type="int"/>
<element name="call_centre_name" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>
</element>
That of course doesn't work because 'Attribute not allowed: maxOccurs' on a
global element like 'ReturnWeb_AdminResellerListNewsCentres' .
Any hints? Googling isn't turning up much. Note that I'm not just trying to
put an array in a complexType, I want an _array_ of complexType .
iksrazal
Re: doc / lit array of complexType ?
Posted by Anne Thomas Manes <at...@gmail.com>.
<element name="ReturnWeb_AdminResellerListNewsCentres">
<complexType>
<sequence>
<element name="ReturnWeb_AdminResellerListNewsCentre
minOccurs="0" maxOccurs="unbounded">
<complexType>
<complexContent>
<extension base="tns:ReturnWebBase">
<sequence>
<element name="news_id" type="int"/>
<element name="call_centre_id" type="int"/>
<element name="call_centre_name" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>
</element>
</sequence>
</complexType>
</element>
On 12/14/05, iksrazal <ik...@gmail.com> wrote:
>
> Hi all,
>
> I've used 'rpc encoded' arrays a lot but now I'm trying to migrate the
> concept
> to doc / lit. Here's what I mean in 'rpc encoded' style :
>
> <complexType name="ReturnWeb_AdminResellerListNewsCentres">
> <complexContent>
> <extension base="tns:ReturnWeb_Base">
> <sequence>
> <element name="list"
>
> type="tns:ArrayOfReturnWeb_AdminResellerListNewsCentres_Item"/></sequence></extension></complexContent></complexType>
> <complexType
> name="ArrayOfReturnWeb_AdminResellerListNewsCentres_Item">
> <complexContent>
> <restriction base="soap11-enc:Array">
> <attribute ref="soap11-enc:arrayType"
>
> wsdl:arrayType="tns:ReturnWeb_AdminResellerListNewsCentres_Item[]"/></restriction></complexContent></complexType>
> <complexType name="ReturnWeb_AdminResellerListNewsCentres_Item">
> <sequence>
> <element name="news_id" type="int"/>
> <element name="call_centre_id" type="int"/>
> <element name="call_centre_name"
> type="string"/></sequence></complexType>
>
> That allows me to do a conversion like so:
>
> ReturnWeb_AdminResellerListNewsCentres result = new
> ReturnWeb_AdminResellerListNewsCentres();
> java.util.List list = new ArrayList();
> // db result set - just an example
> while (rs.next()) {
>
> ReturnWeb_AdminResellerListNewsCentres_Item item
> =
> new ReturnWeb_AdminResellerListNewsCentres_Item(
> rs.getInt("news_id"),
> rs.getInt("call_centre_id"),
> rs.getString("call_centre_name")
> );
>
> list.add(item);
> }
> rs.close();
> ReturnWeb_AdminResellerListNewsCentres_Item[] list_array = new
> ReturnWeb_AdminResellerListNewsCentres_Item[0];
>
> list_array = (ReturnWeb_AdminResellerListNewsCentres_Item[])
> list.toArray(list_array);
> result.setList(list_array);
>
> Sorry for the long example.
>
> Now I'm trying to do the same with doc / lit and I believe, minOccurs and
> maxOccurs:
>
> <!-- shown for completeness -->
> <complexType name="ReturnWebBase">
> <sequence>
> <element name="errorMessage" type="xsd:string"/>
> <element name="successErrorCode" type="xsd:int"/>
> </sequence>
> </complexType>
>
> <element name="ReturnWeb_AdminResellerListNewsCentres" minOccurs="0"
> maxOccurs="unbounded">
> <complexType>
> <complexContent>
> <extension base="tns:ReturnWebBase">
> <sequence>
> <element name="news_id" type="int"/>
> <element name="call_centre_id" type="int"/>
> <element name="call_centre_name" type="string"/>
> </sequence>
> </extension>
> </complexContent>
> </complexType>
> </element>
>
> That of course doesn't work because 'Attribute not allowed: maxOccurs' on
> a
> global element like 'ReturnWeb_AdminResellerListNewsCentres' .
>
> Any hints? Googling isn't turning up much. Note that I'm not just trying
> to
> put an array in a complexType, I want an _array_ of complexType .
> iksrazal
>