c# - ASP.NET Web API 2 XML Post request ignore XML namespace attribute -
for webapi xml request can xml namespace can ignored while model binding.
i want below requests bind correctly orderheader
object:
<orderheader xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <orderdate>2015-07-20t15:00:00</orderdate> <customeraccountnumber>test1</customeraccountnumber> <customerponumber>test2</customerponumber> <customerreferencenumber /> </orderheader> <orderheader> <orderdate>2015-07-20t15:00:00</orderdate> <customeraccountnumber>test1</customeraccountnumber> <customerponumber>test2</customerponumber> <customerreferencenumber /> </orderheader> <orderheader xmlns:i="http://www.w3.org/2001/xmlschema-instance" xmlns="http://schemas.datacontract.org/2004/07/test.models.api"> <orderdate>2015-07-20t15:00:00</orderdate> <customeraccountnumber>test1</customeraccountnumber> <customerponumber>test2</customerponumber> <customerreferencenumber /> </orderheader>
config.formatter.xmlformatter want go. there u can ignore namespace using properties on formatter.
Comments
Post a Comment