Hi,
I've created a WCF web service and generated the xml serialization class with xsd.exe. My problem is that when I request the xsd from the service (http://localhost:59120/Service1.svc?xsd=xsd2) the element names are appended with "Field" does anyone know how to override these default names with the original element names?
Regards Al
I've created a WCF web service and generated the xml serialization class with xsd.exe. My problem is that when I request the xsd from the service (http://localhost:59120/Service1.svc?xsd=xsd2) the element names are appended with "Field" does anyone know how to override these default names with the original element names?
Code:
<xs:sequence>
<xs:element name="addressField" type="xs:string" nillable="true"/>
<xs:element name="emailIdField" type="xs:string" nillable="true"/>
<xs:element name="idField" type="xs:string" nillable="true"/>
<xs:element name="itemsField" type="tns:ArrayOfArrayOfOrdersCustomerItemsItem" nillable="true"/>
<xs:element name="nameField" 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")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public partial class Orders { private OrdersCustomer[] itemsField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("Customer", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)] public OrdersCustomer[] Items { get { return this.itemsField; } set { this.itemsField = value; } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] public partial class OrdersCustomer { private string nameField; private string addressField; private string emailIdField; private OrdersCustomerItemsItem[][] itemsField; private string idField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)] public string Name { get { return this.nameField; } set { this.nameField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)] public string Address { get { return this.addressField; } set { this.addressField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)] public string EmailId { get { return this.emailIdField; } set { this.emailIdField = value; } } /// <remarks/> [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)] [System.Xml.Serialization.XmlArrayItemAttribute("Item", typeof(OrdersCustomerItemsItem), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)] public OrdersCustomerItemsItem[][] Items { get { return this.itemsField; } set { this.itemsField = value; } } /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string Id { get { return this.idField; } set { this.idField = value; } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] public partial class OrdersCustomerItemsItem { private string idField; private string nameField; /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string Id { get { return this.idField; } set { this.idField = value; } } /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string Name { get { return this.nameField; } set { this.nameField = value; } } } }
Regards Al