camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From richardgroote <richard.gro...@gmail.com>
Subject Spring WS Consumer and Attachments
Date Wed, 19 Feb 2014 15:37:21 GMT
Hello,

The org.apache.camel.component.spring.ws.SpringWebserviceConsumer extract
headers and properties of the message context. But cannot find anything
about the attachments. Currently we're using the below processor
implementation to add the received attachments to the exchange. 

Some ideas:
- Is it possible to integrate below within the SpringWebserviceConsumer 
- Is it a idea to put the below example on the wiki page.


public class SoapAttachmentProcessor implements Processor {

	@Override
	public void process(Exchange exchange) throws Exception {
		WebServiceMessage webServiceMessage =
MessageContextHolder.getMessageContext().getRequest();

		if (webServiceMessage instanceof MimeMessage) {
			Iterator<Attachment> attachmentsIterator = ((MimeMessage)
webServiceMessage).getAttachments();
			while (attachmentsIterator.hasNext()) {
				Attachment attachment = attachmentsIterator.next();

				exchange.getIn().addAttachment(attachment.getContentId(),
attachment.getDataHandler());
			}
		}
	}
}




Kind regards,

Richard



--
View this message in context: http://camel.465427.n5.nabble.com/Spring-WS-Consumer-and-Attachments-tp5747567.html
Sent from the Camel Development mailing list archive at Nabble.com.

Mime
View raw message