return;
} else {
InputStream bais = getInputStream();
StreamSource ss = new StreamSource(bais);
Exchange xchng = inMessage.get(Exchange.class);
LOG.fine(new org.apache.cxf.common.i18n.Message("CREATE.NORMALIZED.MESSAGE", LOG).toString());
if (inMessage.getExchange().getOutFaultMessage() != null) {
Exception ex = inMessage.getContent(Exception.class);
if (ex instanceof org.apache.cxf.interceptor.Fault) {
org.apache.cxf.interceptor.Fault f = (org.apache.cxf.interceptor.Fault) inMessage.getContent(Exception.class);
if (!f.hasDetails()) {
xchng.setError(f);
}
} else {
xchng.setError(ex);
}
// As the fault is already marshalled by the fault handler
xchng.getFault().setBody(ss);
} else {
//copy attachments
if (outMessage != null && outMessage.getAttachments() != null) {
for (Attachment att : outMessage.getAttachments()) {
xchng.getOut().addAttachment(att.getId(), att
.getDataHandler());
}
}
//copy properties
for (Map.Entry<String, Object> ent : outMessage.entrySet()) {
//check if value is Serializable, and if value is Map or collection,
//just exclude it since the entry of it may not be Serializable as well
if (ent.getValue() instanceof Serializable
&& !(ent.getValue() instanceof Map)
&& !(ent.getValue() instanceof Collection)) {
xchng.getOut().setHeader(ent.getKey(), ent.getValue());
}
}
//copy securitySubject
xchng.getOut().setSecuritySubject((Subject) outMessage.get(NMRTransportFactory.NMR_SECURITY_SUBJECT));
xchng.getOut().setBody(ss);
}
LOG.fine(new org.apache.cxf.common.i18n.Message("POST.DISPATCH", LOG).toString());
channel.send(xchng);
}
} catch (Exception ex) {