I need my WCF to be able to receive a request with the following structure.
<MyRequest>
<Product>
...attributes
</Product>
<Product>
...attributes
</Product>
<Document>
...attributes
</Document>
</MyRequest>
when creating the data contract and adding the DataMember and XmlElement decorators for the List type attribute, however, I can't get it to receive the list without a container.
[DataContract]
public class MyRequest
{
[DataMember(Order = 0)]
[XmlElement("Product")]
public List<Product> Products { get; set; }
[DataMember(Order = 1)]
[XmlElement("Document")]
public Document Document { get; set; }
public MyRequest()
{
Products = new List<Product>();
Document = new Document();
}
}
[DataContract]
public class Product
{
// ...
}
[DataContract]
public class Document
{
// ...
}