WCF Rest service receiving object as null

前端 未结 1 601
眼角桃花
眼角桃花 2021-01-15 18:58

I have WCF rest service which is expecting object as input.

[WebInvoke(Method = \"POST\",
            UriTemplate = \"SaveItem\",
            ResponseFormat          


        
相关标签:
1条回答
  • 2021-01-15 19:37

    Thanks for sharing your solution. I needed the WebMessageBodyStyle.Bare bit but my other issue was that my JSON was wrapped in a parent "node" per suggestions on other sites like this:

    Not Working --> {"MethodParamName":[{"prop1":"value1","prop2":"value2"}]}
    

    But my JSON was always null. However once I dropped the "parent node" of my JSON my WCF finally could read the object:

    Working --> {"prop1":"value1","prop2":"value2"}
    
    0 讨论(0)
提交回复
热议问题