I was asked to provide the following XML document from the http endpoint, exactly the same: -
<?xml version="1.0" encoding="utf-8"?> <XMLFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SalesOrders> ... </SalesOrders>
However, the web API spits out
<?xml version="1.0" encoding="utf-8"?> <XMLFile xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/White.Label.Ordering.Infrastructure.Data.Queries.Export"> <SalesOrders> ... </SalesOrders>
I have google around and tried various fixes, but to no avail, my model looks like
[DataContract] public class XMLFile { [DataMember] public List<SalesOrder> SalesOrders { get; set; } } [DataContract] public class SalesOrder { [DataMember(Order = 1)] public string OrderNumber { get; set; } }
and my settings like this
public static void Register(HttpConfiguration config) { config.Formatters.XmlFormatter.WriterSettings.OmitXmlDeclaration = false; ... }
How to remove xmlns:i and xmlns and replace with xmlns:xsd and xmlns:xsi ?
I know this is a bad question as it doesn’t matter, but my consumer client works.
Rippo source share