Hi,
I have a WCF web service targeting .Net Framework 4 which utilizes a serialization class generated from a xsd schema using xsd.exe.
When I request the xsd from the service (http://localhost:59120/Service1.svc?xsd=xsd2) the element attributes are being ignored. E.G. in the schema snippet below (<xs:element name="id"...>) should be an attribute (<xs:attribute name="id"...>).
XML
C# Serialization class -Code:... <xs:sequence> <xs:element name="address" type="xs:string" nillable="true"/> <xs:element name="emailId" type="xs:string" nillable="true"/> <xs:element name="id" type="xs:string" nillable="true"/> <xs:element name="items" type="tns:ArrayOfArrayOfOrdersCustomerItemsItem" nillable="true"/> <xs:element name="name" type="xs:string" nillable="true"/> </xs:sequence> ...
C#
Code://------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.296 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ // // This source code was auto-generated by xsd, Version=4.0.30319.1. // namespace WcfService1 { using System.Xml.Serialization; /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [XmlTypeAttribute(AnonymousType = true)] [XmlRootAttribute(Namespace = "", IsNullable = false)] public partial class Orders { /// <remarks/> [XmlElementAttribute("Customer", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 0)] public OrdersCustomer[] Items; } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [XmlTypeAttribute(AnonymousType = true)] public partial class OrdersCustomer { /// <remarks/> [XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 0)] public string Name; /// <remarks/> [XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 1)] public string Address; /// <remarks/> [XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 2)] public string EmailId; /// <remarks/> [XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 3)] [XmlArrayItemAttribute("Item", typeof(OrdersCustomerItemsItem), Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)] public OrdersCustomerItemsItem[][] Items; /// <remarks/> [XmlAttributeAttribute()] public string Id; } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [XmlTypeAttribute(AnonymousType = true)] public partial class OrdersCustomerItemsItem { /// <remarks/> [XmlAttributeAttribute()] public string Id; /// <remarks/> [XmlAttributeAttribute()] public string Name; } }




Reply With Quote