fromNMS(soap, msg, headers);
}
protected void fromNMS(SoapMessage soap, TextMessage msg, Map headers) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SoapWriter writer = soapHelper.getSoapMarshaler().createWriter(soap);
writer.write(baos);
msg.setText(baos.toString());
if (headers != null) {
for (Iterator it = headers.keySet().iterator(); it.hasNext();) {
String name = (String) it.next();
Object value = headers.get(name);
if (shouldIncludeHeader(name, value)) {
msg.setObjectProperty(name, value);
}
}
}
// overwrite whatever content-type was passed on to us with the one
// the SoapWriter constructed
msg.setStringProperty(CONTENT_TYPE, writer.getContentType());
}