} else {
AttachmentSet atts = msg.getAttachments();
if (atts != null && !atts.isEmpty()) {
final ByteArrayBuffer bos = new ByteArrayBuffer();
try {
Codec codec = new XMLHTTPBindingCodec(binding);
com.sun.xml.internal.ws.api.pipe.ContentType ct = codec.getStaticContentType(new Packet(msg));
codec.encode(new Packet(msg), bos);
return createDataSource(ct.getContentType(), bos.newInputStream());
} catch(IOException ioe) {
throw new WebServiceException(ioe);
}