this is the string:
string incomingOrdreXML = @"<GetOrderStatus xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://schemas.datacontract.org/2004/07/OrderStatusConsole""><AccountID>5</AccountID><Batch></Batch><Date></Date><OrderNumber></OrderNumber><Password></Password><Sequence></Sequence><StatusCode></StatusCode><Test></Test><TrackingID></TrackingID></GetOrderStatus>";
this is the class:
public class GetOrderStatus
{
public string AccountID { get; set; }
public string Password { get; set; }
public string Batch { get; set; }
public string Sequence { get; set; }
public string Test { get; set; }
public string Date { get; set; }
public string OrderNumber { get; set; }
public string StatusCode { get; set; }
public string TrackingID { get; set; }
}
this is the deserialization code:
string incomingOrdreXML = @"<GetOrderStatus xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://schemas.datacontract.org/2004/07/OrderStatusConsole""><AccountID>5</AccountID><Batch></Batch><Date></Date><OrderNumber></OrderNumber><Password></Password><Sequence></Sequence><StatusCode></StatusCode><Test></Test><TrackingID></TrackingID></GetOrderStatus>";
var reader = new StringReader(incomingOrdreXML);
XmlSerializer serializer = new XmlSerializer(typeof(GetOrderStatus));
var instance = (GetOrderStatus)serializer.Deserialize(reader);
Fails in the last line, says
{"<GetOrderStatus xmlns='http://schemas.datacontract.org/2004/07/OrderStatusConsole'> was not expected."}
This line will change depending on who sends this XML. Meaning if the sender is OrderStatusConsole then it's like above if the sender is Jeff then it will have Jeff in the end.
Any clues?
Thanks in advance.