I have the following class
[Serializable()]
[XmlType(AnonymousType=true)][XmlRoot(Namespace="", IsNullable=false)]
public class Test
{
[XmlAttribute()]
public string Prop { get; set; }
public string Another { get; set; }
}
I used this class in both a WCF web service (SVC) and an ASMX web service and I'm expecting to get a SOAP body which are consistent for both ASMX and SVC where the "Prop" property is an attribute. Also, I tried adding a service and web reference to both SVC and ASMX and here's how the XSDs looked like:
- Service Reference to SVC: Did not create XmlAttribute attribute for Test.Prop property
- Service Reference to ASMX: Created XmlAttribute attribute for Test.Prop property
- Web Reference to SVC: Created XmlElement for Test.Prop property
- Web Reference to ASMX: Created XmlAttribute attribute for Test.Prop property
My question is why are the generated XSDs and therefore SOAP XMLs not consisted? I know this does not matter as both methods worked regardless of the generated schema.