I'm not sure you are doing anything wrong... There were prior discussions on this error:
CURL POST with vCO 5.1 REST API | VMware Communities
I'm also running 5.1.1 and get the same error when doing a POST with json rather than xml. According to the threads above, this was supposed to resolved with the release of 5.1 update 1.