String operationName = me.getOperation().getLocalPart();
WrappedMessage wrappedMessage = new WrappedMessage();
wrappedMessage.setAbstractMessage(message);
if(message.isFault()) {
wrappedMessage.wrapFault(operationName, emd);
} else {
wrappedMessage.setWSDLBindingStyle(emd.getBindingStyle(operationName));
wrappedMessage.setWSDLMessageType(emd.getInputMessage(operationName).getQName());
wrappedMessage.setWSDLMessageName(emd.getOperationInputName(operationName));
wrappedMessage.setWSDLOrderedParts(emd.getInputMessage(operationName).getOrderedParts(null));
wrappedMessage.setWSDLPartBindings(emd.getInputPartBindings(operationName));
wrappedMessage.wrap();
}
NormalizedMessage normalizedMessage = me.createMessage();
normalizedMessage.setContent(wrappedMessage.readPayloadAsSource());
/**
* Process the attachments.
*/
for(Attachment attachment : (Iterable<Attachment>)message.getAttachments()) {
logger.log(Level.FINE, "Adding attachment to Normalized Message, attachmentID = "
+ attachment.getContentId());
normalizedMessage.addAttachment(attachment.getContentId(), attachment.asDataHandler());
}
send(normalizedMessage);