ContentFormat contentFormat = new ContentFormat();
contentFormat.setEncoding(StandardCharsets.UTF_8.name());
contentFormat.setMimetype("text/plain");
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
contentService.write(reference, Constants.PROP_CONTENT, newContent.getBytes(), contentFormat);
} finally {
AuthenticationUtils.endSession();
}