Hello,
 
I need a bit of understanding on how my service contract and the resulting WCF response would affect the client app that would consume my WCF service. Below are the details that I have in my code. Can you help me with the questions below please?
 
1. In WCF's XML response, how do I change the element to another name by using any XML attribute or WCF functionality?

2. In the same output, how do I change into another name as well, without changing the Class name? I can see WCF is using the class name to come up with this element name.

3. Does specifying the XmlElement name attribute ONLY CHANGES THE output display, and not the underlying field/property when this service is consumed by the calling app? I'm checking the output by using the WCF Test Client only and seeing the XML response. Or is the XMLElement name the one to be seen by the calling app?
 
I've use XMLroot, CollectionsDataContract, and a bunch of other things to put on top of the FinalXmlEntity class to change it's XML element name in the output, but no success. The change in the data members' names have been successful though.
 
Thank you in advance.
 
 
SERVICE INTERFACE:
 
    [ServiceContract]
    [XmlSerializerFormat(Style = OperationFormatStyle.Document)]
    public interface IService1
    {
        [OperationContract]
        List ExtractList();
 
    }
 
DATA CONTRACT:
 
[DataContract]
    public class ProgrammeList
    {
        [DataMember]
        public string EmpCode { get; set; }
 
        [XmlElement("Employee Link")]
        [DataMember]
        public string EmpLink { get; set; }
 
        [DataMember]
        public string RoleCode { get; set; }
 
        [XmlArray("EmploymentHistory"), XmlArrayItem("Company")]
        [DataMember]
        public List EmploymentLink { get; set; }
    }
 
 
RETURNED LIST COLLECTION:
 
 [Serializable]
    public class FinalXmlEntity
    {
        public string EmpCode { get; set; }
 
        [XmlElement("Employee")]
        public string EmployeeLink { get; set; }
 
        public string RoleCode { get; set; }
 
        [XmlArray("EmploymentHistory"), XmlArrayItem("Company")]
        public List EmploymentLink { get; set; }
 
        public FinalXmlEntity(string s1, string s2, string s3, List ListComp)
        {
            EmpCode = s1;
            EmployeeLink = s2;
            RoleCode = s3;
            EmploymentLink = ListComp;
        }
        public FinalXmlEntity()
        {
        }
    }
 
WCF TEST CLIENT's  RESPONSE OUTPUT (in XML tab)
 
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     
       
          ABC245
          John Michael Doe
          DD
         
                  XYZ Digital Corporation
                  Multiply My Profit Inc.
                  Hirem and Firem Ltd.
         

       

 ...
...
...