Model always null on XML POST

前端 未结 5 1259
耶瑟儿~
耶瑟儿~ 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条回答
  •  -上瘾入骨i
    2020-11-30 23:02

    I was trying to solve this for two days. Eventually I found out the outer tag needs to be the type name, not the variable name. Effectively, with the POST method as

    public string Post([FromBody]TestModel model)
    {
        return model.Output;
    }
    

    I was providing the body

    Sito
    

    instead of

    Sito
    

提交回复
热议问题