Using javax.ws I need to create a POJO object for POST to a service. The input that I must POST:
{
"attributes": {
"firstname": "John",
"surname": "Doe",
"birthyear": 1965
}
}
I set this up in a class below and then try to call it with:
AuditTrail auditTrail = new AuditTrail(...);
final Response response = app.target(MY_END_POINT)
.path(auditTrailPath.toString())
.request()
.post(Entity.json(auditTrail));
But i get a HTTP error 204, No Content.
Am I doing this right ?
public class AuditTrail implements Serializable {
@JsonProperty("attributes")
public HashMap<String, String> attributes;
public AuditTrail() {
attributes = new HashMap<String, String>();
}
public AuditTrail(...) {
attributes = new HashMap<String, String>();
// Set values here...
}
public HashMap<String, String> getAttributes() {
return attributes;
}
public void setAttributes(HashMap<String, String> attributes) {
this.attributes = attributes;
}
}