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