I have a basic WCF service that takes some xml. Some of the xml is a list like so:
<Root>
<Products>
<Product>
<SKU>1234</SKU>
<Price>2533</Price>
<ProductName>Brown Shows</ProductName>
<Quantity>1</Quantity>
</Product>
<Product>
<SKU>345345</SKU>
<Price>2345</Price>
<ProductName>Red Shows</ProductName>
<Quantity>1</Quantity>
</Product>
</Products>
</Root>
In my class that this gets stored into I have:
[DataMember(Name = "Products", Order = 4, IsRequired = false, EmitDefaultValue = false)]
public List<Product> products;
Then in my Product class I have the SKU, Price, ProductName, and Quantity. Other non list items in my class are being set, but it doesnt appear as if the xml is populating my list. Am I missing something?
Heres my Product class
public class Product
{
[DataMember(Name = "SKU", Order = 0)]
public string sku;
// for the request
[DataMember(Name = "Price", Order = 1, IsRequired = false, EmitDefaultValue = false)]
public int price;
[DataMember(Name = "ProductName", Order = 2, IsRequired = false, EmitDefaultValue = false)]
public string productName;
[DataMember(Name = "Quantity", Order = 3, IsRequired = false, EmitDefaultValue = false)]
public int quantity;
// for the response
[DataMember(Name = "Available", Order = 1, IsRequired = false, EmitDefaultValue = false)]
public string available;
}