String attachment = msgElem.getAttribute(MailService.A_ATTACHMENT_ID, null);  ParseMimeMessage.MimeMessageData mimeData = new ParseMimeMessage.MimeMessageData(); MimeMessage mm; if (attachment != null) mm = SendMsg.parseUploadedMessage(lc, attachment, mimeData); else mm = ParseMimeMessage.parseMimeMsgSoap(lc, mbox, msgElem, null, mimeData);  long date = System.currentTimeMillis();  try { mm.saveChanges(); } catch (MessagingException me) { throw ServiceException.FAILURE("completing MIME message object", me); }  ParsedMessage pm = new ParsedMessage(mm, date, mbox.attachmentsIndexingEnabled()); try { pm.analyze(); } catch (ServiceException e) { if (ConversionException.isTemporaryCauseOf(e)) throw e; }  WikiItem wikiItem; try { wikiItem = mbox.createWiki(octxt, pm, wiki.getWikiFolderId()); } catch (IOException ioe) { throw ServiceException.FAILURE("creating wiki item", ioe); }
byte[] rawData = msgElem.getText().getBytes(); WikiItem wikiItem = mbox.createWiki(octxt, wiki.getWikiFolderId(), subject, rawData, null);
	public Element handle(Element request, Map context)			throws ServiceException, SoapFaultException {		Wiki wiki = Wiki.getInstance();        ZimbraContext lc = getZimbraContext(context);        Mailbox mbox = Mailbox.getMailboxByAccountId(wiki.getWikiAccountId());        OperationContext octxt = lc.getOperationContext();        Element msgElem = request.getElement(MailService.E_MSG);        // check to see whether the entire message has been uploaded under separate cover        String attachment = msgElem.getAttribute(MailService.A_ATTACHMENT_ID, null);        ParseMimeMessage.MimeMessageData mimeData = new ParseMimeMessage.MimeMessageData();        MimeMessage mm;        if (attachment != null)            mm = SendMsg.parseUploadedMessage(lc, attachment, mimeData);        else            mm = ParseMimeMessage.parseMimeMsgSoap(lc, mbox, msgElem, null, mimeData);        long date = System.currentTimeMillis();        try {            mm.saveChanges();        } catch (MessagingException me) {            throw ServiceException.FAILURE("completing MIME message object", me);        }        ParsedMessage pm = new ParsedMessage(mm, date, mbox.attachmentsIndexingEnabled());        try {            pm.analyze();        } catch (ServiceException e) {            if (ConversionException.isTemporaryCauseOf(e))                throw e;        }        WikiItem wikiItem;        try {    		wikiItem = mbox.createWiki(octxt, pm, wiki.getWikiFolderId());        } catch (IOException ioe) {        	throw ServiceException.FAILURE("creating wiki item", ioe);        }		wiki.addWiki(wikiItem);        // we can now purge the uploaded attachments        if (mimeData.uploads != null)            FileUploadServlet.deleteUploads(mimeData.uploads);        Element response = lc.createElement(MailService.SAVE_WIKI_RESPONSE);        Element m = response.addElement(MailService.E_MSG);        m.addAttribute(MailService.A_ID, lc.formatItemId(wikiItem));        return response;	}