OpenNTF/SocialSDK

Commented feature: attachment upload to an activity node

Closed this issue · 3 comments

We are missing one feature in the SBT. The upload of an attachment to an activity node.
With a little research we found out that there is already a function in the SBT SDK, but there is a comment around it...
Is there a special reason for this? Was there a problem with the upload? We also tried to use just the REST API, but couldn't figure out what content type we should upload. The documentation there only says that it should be multipart, but not more.
Is there a plan that the feature will come back? Or can anybody else help me?

@JulianMeinhardt sure. the code in the SBT only uploads attachments as Entries. it does not attach to reply/entry. You need to use PUT to update / upload the attachment.

@prb112 I don't really understand what you're trying to say to me. Do I understand your answer correct and it is not possible to post an entry with an attachment? So I have to post the node first and then update it with the attachment?

I tried a few things but nothing really works correct:

  1. I tried to made a POST request with SOAPUI and chose multipart/related as Content-Type and an attachment in it. The result was a new entry with an attachment and the correct filename, but the file was corrupt.
  2. I tried to upload the attachment via the xhrPost method from my endpoint and a handbuild MIMEEntity as content. But got an exception because the MultipartEntity is not supported...
    MultipartEntityBuilder builder = MultipartEntityBuilder.create();
    builder.addTextBody("Entry", xml, ContentType.APPLICATION_ATOM_XML);
    builder.addBinaryBody("file", new File("C:\Test\test.pdf"), ContentType.DEFAULT_BINARY, "test.pdf");
    HttpEntity multipart = builder.build();
  3. I tried to upload the attachment with a handbuild ContentList of ContentParts with the result. that the MIME Type was missing and a broken attachment was uploaded:
    ArrayList<ClientService.ContentPart> list = new ArrayList<ClientService.ContentPart>();
    FileInputStream in = new FileInputStream("C:\Test\test.pdf");
    ClientService.ContentPart filePart = new ClientService.ContentPart("attachment",in, "test.pdf", "application/pdf");
    list.add(filePart);
    endpoint.xhrPost(URL_OF_ACTIVITY,list);
  4. The last thing if tried is to use the newest version of the SBT in Domino and upload the attachment with the uploadFile method of an ActivityService. But i get a NoClassDefFoundError when initializing the ActivityService:
    ActivityService actService = new ActivityService("smartcloud");
    actService.uploadFile(UuidOfActivityNode, "test.jpg", inPic, "image/jpeg");

At this time, there are no plans to add this feature.