I am working on a web service to insert data into a sqd server, as I am new to this, I am doing small tests.
You have created a rest web service in netbeans, create a person entity, the only thing that the service does is receive an object in xml or json format and then store it in persistence. When I send an xml format like this:
<persona>
<idPersona>20</idPersona>
<nombre>Albert</nombre>
<trabajador>true</trabajador>
</persona>"
Works fine, but when I send the object in json format like this:
{
"idPersona":"20",
"nombre":"Bernard",
"trabajador":"true"
}
I get a 500 (Internal Server Error). I have been guiding a tutorial online, I followed all the steps, in the tutorial there are pictures and everything is perfect, but in my case it is not like that.
Did someone have the same problem? I hope you can help me. Thank you.
You treat your boolean like a string and persona is missing. But your json should look like this:
{
"persona": {
"idPersona": "20",
"nombre": "Bernard",
"trabajador": true
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.