I can successfully post XML data to my service, but, trying to do the same using JSON is failing. The POJO is:
@XmlRootElement
public class Address {
String city;
String zip;
//Getters & setters...
}
The service resource is:
@POST
@Produces("application/json")
public Address fix(Address a) {
return a;
}
I am doing a POST as follows:
POST /AcmeWeb/svc/simple HTTP/1.1
Content-Length: 30
Content-Type: application/json; charset=UTF-8
{"city":"Miami","zip":"33130"}
The server is responding with a 400 Bad Request. I scoured the Internet but found no good example of posting JSON. Any help is appreciated. Thanks.