Created
July 11, 2011 08:51
-
-
Save estebanroblesluna/1075558 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddAttachmentMessageProcessor implements MessageProcessor | |
{ | |
@Override | |
public MuleEvent process(MuleEvent event) throws MuleException | |
{ | |
Collection<Attachment> attachments = new ArrayList<Attachment>(); | |
AttachmentImpl attachment = new AttachmentImpl("1"); | |
String attachmentXML = ""; | |
try | |
{ | |
attachmentXML = IOUtils.getResourceAsString("attachment.xml", this.getClass()); | |
} | |
catch (IOException e) | |
{ | |
e.printStackTrace(); | |
} | |
DataSource source = new ByteArrayDataSource(attachmentXML.getBytes(), "text/xml"); | |
attachment.setDataHandler(new ConfigurableDataHandler(source)); | |
attachments.add(attachment); | |
event.getMessage().setInvocationProperty(CxfConstants.ATTACHMENTS, attachments); | |
return event; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment