Results 1 to 2 of 2

Thread: [SOLVED] How to retrieve/save an attachment file in a mail with SaveDocumentRequest ?

  1. #1
    Join Date
    Aug 2009
    Rep Power

    Unhappy [SOLVED] How to retrieve/save an attachment file in a mail with SaveDocumentRequest ?

    Hello all

    I need to download an attachment file from a mail in SOAP with Java classes in com.zimbra.cs.zclient but I am having trouble.

    For this I've done these following steps :
    1) I get the corresponding mail with ZConversation and ZMessage
    2) I retrieve the MimePart of the mail with ZMimePart
    3) In the response of the GetMsgRequest I only have for information (concerning the attachment file(s)) : their name - size - type and the idPart of the message

    Response : <mp s="773" filename="monFichier.xml" part="2" ct="application/xml" cd="attachment"/><mp s="86047" filename="monFichier2.jsp" part="3" ct="application/octet-stream" cd="attachment"/></mp>
    4) I have guessed that the solution is to call the SaveDocumentRequest which is detailed in ZimbraServer/doc/soap-wiki.txt (or in like this :

      <doc [id="{item-id}" ver="{last-known-version}"] [name="{file-name}"] [ct="{content-type}"] [l="{folder-id}"]>
        [<upload id="{upload-id}"/>]
        [<m id="{msg-id}" part="{part-id}"/>]
    But when I do the request an error occurs :

    Here is the request I made (with the information I can fill in :
    <SaveDocumentRequest xmlns="urn:zimbraMail"><doc name="monFichier2.jsp" l="5" ct="application/octet-stream"><m id="354" part="3"/></doc></SaveDocumentRequest>
    Here is the error message (in zimbra/log/mailbox.log) :
    com.zimbra.common.soap.SoapFaultException: system failure: cannot create ParsedDocument
    	at com.zimbra.common.service.ServiceException.FAILURE(
    Is anybody know how to resolve this ?

    Thank you in advance for your help.

  2. #2
    Join Date
    Aug 2009
    Rep Power


    Eventually I found the answer.

    With the GET_MSG_REQUEST I get the url REST of the concerned file. For this I have set the MailConstants.A_PART and the MailConstants.A_RAW attributes.
    Then I get the content of the file (an inputstream) with this line :

    I hope this post may interest some of you

Similar Threads

  1. Replies: 7
    Last Post: 02-03-2011, 06:01 AM
  2. No email in or out
    By ValueVPS in forum Installation
    Replies: 37
    Last Post: 01-13-2010, 11:56 AM
  3. server dropped connection
    By ferra in forum Installation
    Replies: 20
    Last Post: 10-06-2008, 04:32 PM
  4. Replies: 2
    Last Post: 02-12-2008, 10:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts