File tmpFile = TestContext.getTempFile();
entity.getEntityType().getMarshaller().marshal(entity, tmpFile);
WebResource resource = context.service.path("api/entities/update/"
+ entity.getEntityType().name().toLowerCase() + "/" + entity.getName());
if (endTime != null) {
resource = resource.queryParam("effective", SchemaHelper.formatDateUTC(endTime));
}
ClientResponse response = resource
.header("Cookie", context.getAuthenticationToken())
.accept(MediaType.TEXT_XML)
.post(ClientResponse.class, context.getServletInputStream(tmpFile.getAbsolutePath()));