I am trying to create the participant and register it with a protocol. I am using java. Our openspecimen was deployed to a testing server using HTTPS. We could not move to the production because the java api we used to create participant in catissueplus does not work with openspecimen. So I am testing to REST api for openspecimen.
Up to now I could
- connect to the Https REST server
- create participant.
The problems now:
- I failed to matching the existing participant, I think I could work round it by querying the database directly instead of using REST API.
- I failed to create participant registration with protocol, the error is 400, “request sent by the client was syntactically incorrect”. I think the problem is how to pass the participant details. Should it be the participant object?
I created the class for participant registration:
public class ParticipantRegistration {
private ParticipantDetail participantDetail; //this is the object used to create participant
private String cpId;
private String ppId;
private String barcode;
private String activityStatus;
private Date registrationDate;
private Long id;
}
here is the code for creating registration:
ClientResponse response = null;
WebResource service = client.resource(getBaseURI() + “/collection-protocols/”+cpID+“registrations”);
try {
response = service.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, PartRegObjToBeRegistered);
System.out.println(response.getStatus()); // now the error is 400
}
here is the error in log of openspecimen server:
ERROR 2014-11-05 15:59:13,909 dao.connectionmanager.DataSourceConnectionManager - dao.method.without.implementation
I appreciate any suggestions.
Regards,
JJ