* @return content-id URI, cid, to the attachment containing data or null if data should be inlined.
*/
public String addMtomAttachment(DataHandler data, String elementNamespace, String elementLocalName)
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
QName xmlName = new QName(elementNamespace, elementLocalName);
if(log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + "]");
String cid = soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart());
AttachmentPart xopPart = soapMessage.createAttachmentPart(data);
xopPart.addMimeHeader(MimeConstants.CONTENT_ID, '<' + cid + '>'); // RFC2392 requirement
soapMessage.addAttachmentPart(xopPart);
if(log.isDebugEnabled()) log.debug("Created attachment part " + cid + ", with content-type " + xopPart.getContentType());
return "cid:" + cid;
}