My C# .NET Web API (v4.7.2) application currently has a request body called with xmlns attribute, but another new users sends request to the same endpoint without any attributes. I use System.Xml.Serialization
. I tried many times, but I couldn't build a structure to run both at the same time. Can we do this too? If not, do you have any other suggestions?
Sample 1:
<YourModel>
<Person>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
<Age>30</Age>
<Address>
<City>New York</City>
<Street>Main Street</Street>
<ZipCode>10001</ZipCode>
</Address>
</Person>
<Person>
<FirstName>Jane</FirstName>
<LastName>Smith</LastName>
<Age>28</Age>
<Address>
<City>Los Angeles</City>
<Street>Hollywood Blvd</Street>
<ZipCode>90001</ZipCode>
</Address>
</Person>
</YourModel>
Sample 2:
<YourModel xmlns="http://abcxyz.com">
<Person>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
<Age>30</Age>
<Address>
<City>New York</City>
<Street>Main Street</Street>
<ZipCode>10001</ZipCode>
</Address>
</Person>
<Person>
<FirstName>Jane</FirstName>
<LastName>Smith</LastName>
<Age>28</Age>
<Address>
<City>Los Angeles</City>
<Street>Hollywood Blvd</Street>
<ZipCode>90001</ZipCode>
</Address>
</Person>
</YourModel>