Hi everyone..
I have a WCF service that uses Message contract for request and replies of data. This is the service contract :
[ServiceContract()]
public interface ISalesFinderService
{
[OperationContract()]
Response DoSomething(Request i_Info);
}
The problem occurs when the service returns a response. This is the Response Message:
[MessageContract()]
public class ObjectInfo
{
[MessageBodyMember(Name = "Name")]
public string m_Name;
}
[MessageContract()]
public class Response
{
private List<ObjectInfo> m_MyListOfObjects;
public FindSalesByLocationInfoMessageResponse()
{
m_MyListOfObjects = new List<ObjectInfo>();
}
[MessageBodyMember(Name = "ObjectsInfo")]
public List<ObjectInfo> MyListOfObjects
{
get { return m_MyListOfObjects; }
set { m_MyListOfObjects = value; }
}
}
When the response comes out I can see (through wireshark) that all the fields inside the list (of type ObjectInfo) were serialized to XML and got the tag <a:m_Name></a:m_Name>
although I added specifically MessageBodyMember attribute above the m_Name
data member and gave it "Name" as it's tag.
How can I change those tags names as I wish ???
thanks..