With this code it works: 

File file = new File(DOC); 
FileDataSource ds = new FileDataSource(file);
                        
List<Attachment> attachments = new ArrayList<Attachment>();
InternetHeaders headers = new InternetHeaders();
headers.addHeader("Content-Type", "application/pdf");
headers.addHeader("Content-ID", "doc.pdf");
headers.addHeader("Content-Transfer-Encoding", "base64");
headers.addHeader("Content-Disposition",
"filename="+"123456789034567834567");
                         
Attachment attach = AttachmentUtil.createAttachment(ds.getInputStream(),
headers);
attachments.add(attach);

BindingProvider bp = (BindingProvider) client; 
java.util.Map&lt;String, Object&gt; reqContext = bp.getRequestContext();
reqContext.put( Message.ATTACHMENTS, attachments ); 

thanks!


--
View this message in context: 
http://cxf.547215.n5.nabble.com/add-attachment-to-a-cxf-client-tp4773822p4777834.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to