Model always null on XML POST

前端 未结 5 1263
耶瑟儿~
耶瑟儿~ 2020-11-30 22:36

I\'m currently working on an integration between systems and I\'ve decided to use WebApi for it, but I\'m running into an issue...

Let\'s say I have a model:

5条回答
  •  Happy的楠姐
    2020-11-30 22:54

    Once you make sure that you setup the Content-Type header to application/xml and set config.Formatters.XmlFormatter.UseXmlSerializer = true; in the Register method of the WebApiConfig.cs, it is important that you will not need any versioning or encoding at the top of your XML document.

    This last piece was getting me stuck, hope this helps somebody out there and saves your time.

提交回复
热议问题