• Post Reply Bookmark Topic Watch Topic
  • New Topic

OUTBOUND_MESSAGE_ATTACHMENTS not sent to server side

 
Adrian Barna
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
can someone please tell me why the OUTBOUND_MESSAGE_ATTACHMENTS is not sent on server side?

When I'm trying (on server side) to get the attachments like:

Map<String, DataHandler> attachmentsMap = (Map<String, DataHandler>) msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
DataHandler dh = !attachmentsMap.values().isEmpty() ? attachmentsMap.values().iterator().next() : null;

dh is null.

but on client side just before sending the request if I do:

Map<String, DataHandler> attachmentsMap = (Map<String, DataHandler>) msgContext.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
DataHandler dh = !attachmentsMap.values().isEmpty() ? attachmentsMap.values().iterator().next() : null;
InputStream in=dh.getInputStream();


the InputStream is populated just fine.

Please find below how I put the attachment in OUTBOUND:

Map<String, DataHandler> attachmentsMap = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
ByteArrayDataSource bads = new ByteArrayDataSource(file, PDF_MIME_TYPE);
DataHandler dh = new DataHandler(bads);

AttachmentPart attachmentPart = message.createAttachmentPart();
attachmentPart.setContent(new ByteArrayInputStream(file), PDF_MIME_TYPE);
attachmentPart.setContentId("<unicredit@test.eu>");

message.addAttachmentPart(attachmentPart);
attachmentsMap.put(fileId, dh);

Thank you in advance!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!