Web Service Factory: Creating a schema for a System.Collections.Generic.List<customer>

  • Thread starter Henrik Skak Pedersen
  • Start date

Henrik Skak Pedersen


I have created a xsd file with a element called Customer. When I then select
"Create data types from schema" a customer class is being generated. But how
do I handle a list of customers? In code I would of course like to use a
generic list, but how does that fit into the factory?

Is it a problem that the List not is a part of the schema?

I guess that I can't use it in the factory wizards?


Steven Cheng[MSFT]

Hello Henrik,

As for the "Create data types from schema", are you using the xsd.exe
utility or any other component to generate the class from XSD schema?

For Genericic List<xxx> type of any other Array/List based types, .net
webservice or XML seriailation will use the following like XML Array
element to map them(the "ArrayOfCustomer" element):

<xs:schema elementFormDefault="qualified"
<xs:element name="ArrayOfCustomer" nillable="true" type="ArrayOfCustomer"
<xs:complexType name="ArrayOfCustomer">
<xs:element minOccurs="0" maxOccurs="unbounded" name="Customer"
nillable="true" type="Customer" />
<xs:complexType name="Customer">
<xs:element minOccurs="0" maxOccurs="1" name="FirstName"
type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="LastName"
type="xs:string" />

Actually, such class as Generic List<> , ArrayList, custom Collection are
all .net specific, XML/XSD schemea does not have so specific definiation
for them. and it can only use a xml array or custom elemetn with sequential
elements to represent them.

Hope this helps.


Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads