}
}
// set the message payload to the message context
InputStream in;
ManagedDataSource dataSource;
if (builder instanceof DataSourceMessageBuilder && entry.isStreaming()) {
in = null;
dataSource = ManagedDataSourceFactory.create(
new FileObjectDataSource(file, contentType));
} else {
in = content.getInputStream();
dataSource = null;
}
try {
OMElement documentElement;
if (in != null) {
documentElement = builder.processDocument(in, contentType, msgContext);
} else {
documentElement = ((DataSourceMessageBuilder)builder).processDocument(
dataSource, contentType, msgContext);
}
msgContext.setEnvelope(TransportUtils.createSOAPEnvelope(documentElement));
handleIncomingMessage(
msgContext,
transportHeaders,
null, //* SOAP Action - not applicable *//
contentType
);
}
finally {
if (in != null) {
try {
in.close();
} catch (IOException ex) {
handleException("Error closing stream", ex);
}
} else {
dataSource.destroy();
}
}
if (log.isDebugEnabled()) {
log.debug("Processed file : " + file + " of Content-type : " + contentType);