Results 1 to 6 of 6

Thread: Contact Image attachment SOAP

  1. #1
    Join Date
    Feb 2008
    Posts
    106
    Rep Power
    7

    Default Contact Image attachment SOAP

    Hello, I don't find in the documnetation how to attach Image via soap
    I try to send follow request, but error occur.
    <?xml version='1.0'?>
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
    <context xmlns="urn:zimbra">
    <authToken>0_10bb9c74c439595ff6dde77c19735bc779dd4 97f_69643d33363a66303866323361362d356366632d346262 322d613036622d6334623834353661613531613b6578703d31 333a313230323238373438353030373b747970653d363a7a69 6d6272613b6d61696c686f73743d31353a3139322e3136382e 332e31353a38303b</authToken>
    <change token='4308'/>
    <sessionId id='15985'/>
    <userAgent name='ZimbraFunambol Connector'
    version='0.2.80'/>
    </context>
    </Header>
    <soap:Body>
    <CreateContactRequest xmlns="urn:zimbraMail">
    <cn>
    <a n='firstName'>Ppppp2</a>
    <a
    n='image'
    aid='1202114684171'/>
    </cn>
    <mp
    part='image'
    s='1452'
    mid='1202114684171'>
    <content>/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFh YaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKC goKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAA2AEgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJ xFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3O Dk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIW Gh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx 8jJytLT1NXW19jZ2uHi4+T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U9HkhES218p7swXH86ybrxfpk27yp Ey394Ff6VG/hLQVj3bLj/v5WHe6FpaFvKWXGeMuaww+HwrfuKSKpvOMHFubpv1v+hZuPFEc hIjZVPTPJ/WqcmvM3/LcGqh0qyVuA/8A31TTptmP7/8A31Xrwp0orRHlYjMMym/elFejZJJq27/lrmiqj2FoOgf/AL6orVKPY8yeJxjesl97NAScClZzg+1FFcqPYTZEHIer+mzFpe nAoopzXuDws5KskmbIvmkDLt5X346VjXs2fpRRXNQilLQ9fHVZ OjqzO87cM846UjuR06GiivQPk5SbV2VpXJ4yaKKKpHFPc//Z</content>
    </mp>
    </CreateContactRequest>
    </Body>
    </Envelope>

    The content contain base64 encoded image, it correct?

  2. #2
    Join Date
    Feb 2008
    Posts
    106
    Rep Power
    7

    Default

    I find what I have to upload image to /service/upload servlet, I write simple code like httpclient example. But I can't set cookie for autorization token.
    My code:
    HttpClient client = new HttpClient();
    client.getHttpConnectionManager().
    getParams().setConnectionTimeout(8000);
    HttpState initialState = new HttpState();
    Cookie mycookie = new Cookie("."+endpoint.getAuthority(), "ZM_AUTH_TOKEN", ccontext.getAuthToken(), "/", null, false);
    initialState.addCookie(mycookie);
    client.setState(initialState);
    Help me please

  3. #3
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default

    Perhaps an issue with the first argument to setCookie? See if using the target hostname there solves the problem.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  4. #4
    Join Date
    Feb 2008
    Posts
    106
    Rep Power
    7

    Default

    Quote Originally Posted by dkarp View Post
    Perhaps an issue with the first argument to setCookie? See if using the target hostname there solves the problem.
    Hello, Thanks for answer.

    I did at second way:
    PHP Code:
    Cookie mycookie = new Cookie("."+endpoint.getAuthority(), "ZM_AUTH_TOKEN"token"/"nullfalse);
    filePost.setRequestHeader("Cookie"mycookie.toExternalForm()); 
    I have an another question. How I can download image from zimbra? I have a attribute at the contact:
    Code:
    <a s='1452'
                       n='image'
                       filename='image'
                       part='1'
                       ct='application/octet-stream; charset=iso-8859-1'/>
    I think I can do something with 's' attribute, but don't know what exactly.
    Last edited by wolfroma; 02-05-2008 at 05:14 AM.

  5. #5
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default

    Try something like http://yourserver.com/service/home/~/?id={contact-id}&part=1 (I got the "part=1" bit from the attachment info you posted). Note that you're uploading things as application/octet-stream, which is probably not what you want...
    Bugzilla - Wiki - Downloads - Before posting... Search!

  6. #6
    Join Date
    Feb 2008
    Posts
    106
    Rep Power
    7

    Default

    Quote Originally Posted by dkarp View Post
    Try something like http://yourserver.com/service/home/~/?id={contact-id}&part=1 (I got the "part=1" bit from the attachment info you posted). Note that you're uploading things as application/octet-stream, which is probably not what you want...
    Thanks for answer. It was very helpful.

Similar Threads

  1. Replies: 12
    Last Post: 06-13-2013, 08:55 AM
  2. XSD/WSDL Files for the SOAP Server?
    By photoadrian in forum Developers
    Replies: 5
    Last Post: 12-23-2012, 01:32 AM
  3. Jar For Soap Client
    By wcameron in forum Developers
    Replies: 19
    Last Post: 06-03-2009, 02:04 PM
  4. Replies: 3
    Last Post: 08-11-2007, 12:40 PM
  5. Outlook Migration Wizard + Contact Groups
    By thegeekiator in forum Migration
    Replies: 4
    Last Post: 07-13-2007, 03:00 PM

Posting Permissions

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