I'm sending an attachment using Apache CXF implementation. Even if I set the name of the dataHandler I don't know why is not reveiced on the server side.
Map<String, DataHandler> attachmentsMap = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
ByteArrayDataSource bads = new ByteArrayDataSource(file, PDF_MIME_TYPE);
bads.setName(fileId);
DataHandler dh = new DataHandler(bads);
AttachmentPart attachmentPart = message.createAttachmentPart();
attachmentPart.setContent(new ByteArrayInputStream(file), PDF_MIME_TYPE);
attachmentPart.setContentId(fileId);
attachmentPart.setMimeHeader("fileName", "test");
message.addAttachmentPart(attachmentPart);
message.saveChanges();
attachmentsMap.put(fileId, dh);
As you can see when I do "bads.setName(fileId);" also the name of the dataHandler is set. Locally if I do dh.getName I have the name set. After sending it is not present anymore