if (saajOut != null) {
doSoap(message);
} else if (DataSource.class.isAssignableFrom(type)) {
//datasource stuff, must check if multi-source
MessageContentsList list = (MessageContentsList)message.getContent(List.class);
DataSource ds = (DataSource)list.get(0);
String ct = ds.getContentType();
if (ct.toLowerCase().contains("multipart/related")) {
Message msg = new MessageImpl();
msg.setExchange(message.getExchange());
msg.put(Message.CONTENT_TYPE, ct);
try {
msg.setContent(InputStream.class, ds.getInputStream());
AttachmentDeserializer deser = new AttachmentDeserializer(msg);
deser.initializeAttachments();
} catch (IOException ex) {
throw new Fault(ex);
}
message.setAttachments(msg.getAttachments());
final InputStream in = msg.getContent(InputStream.class);
final String ct2 = (String)msg.get(Message.CONTENT_TYPE);
list.set(0, new DataSource() {
public String getContentType() {
return ct2;
}
public InputStream getInputStream() throws IOException {
return in;
}
public String getName() {
return ct2;
}
public OutputStream getOutputStream() throws IOException {
// TODO Auto-generated method stub
return null;
}
});
} else if (!ct.toLowerCase().contains("xml")) {
//not XML based, need to stream out directly. This is a bit tricky as
//we don't want the stax stuff triggering and such
OutputStream out = message.getContent(OutputStream.class);
message.put(Message.CONTENT_TYPE, ct);
try {
InputStream in = ds.getInputStream();
IOUtils.copy(in, out);
in.close();
out.flush();
out.close();
} catch (IOException e) {