I am currently converting a HttpListener application to a WCF web service. The web service will be consumed by a Windows CE 5.0 client running .NETCF 2.0. I have this working fine already via a Web Reference (not a Service Reference). And it may be worth mentioning here that i am unable to upgrade the framework version from 2.0 to 3.0 or 3.5.
The issue i am having is that i have multiple classes that contain List properties (like the one below)
[Serializable]
[XmlRoot]
public class Products
{
public Products()
{
Items = new List<Product>();
Errors = new List<Error>();
}
[XmlElement]
public List<Product> Items
{ get; set; }
[XmlElement]
public List<Error> Errors
{ get; set; }
[XmlElement]
public long DeviceId
{ get; set; }
[XmlElement]
public User UserId
{ get; set; }
[XmlElement]
public long UserColour
{ get; set; }
}
Which when this property is passed through the Web Reference the List becomes an Array (shown below)
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://server-path/Service.svc")]
public partial class Products {
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Items")]
public Product[] Items;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Errors")]
public Error[] Errors;
/// <remarks/>
public long DeviceId;
/// <remarks/>
public User UserId;
/// <remarks/>
public long UserColour;
}
I am aware that using Service References it is possible to change the collection type of collections passed through the service, however i do not know how i can achieve this using a Web Reference.
I have seen many other similar questions, like this and this, but the usual solution is to use a Service Reference, which i am unable to use.
Is there a way i can maintain the collection type across the web service, or a workaround i can implement client-side?
Thanks, Haden