msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
new VFSOutTransportInfo(replyFileURI, entry.isFileLockingEnabled()));
}
// Determine the message builder to use
Builder builder;
if (contentType == null) {
log.debug("No content type specified. Using SOAP builder.");
builder = new SOAPBuilder();
} else {
int index = contentType.indexOf(';');
String type = index > 0 ? contentType.substring(0, index) : contentType;
builder = BuilderUtil.getBuilderFromSelector(type, msgContext);
if (builder == null) {
if (log.isDebugEnabled()) {
log.debug("No message builder found for type '" + type +
"'. Falling back to SOAP.");
}
builder = new SOAPBuilder();
}
}
// 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));