Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-04-2008, 02:07 AM
Project Contributor
 
Posts: 106
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 Dk6Q0RFRkdISUpTVF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UqNB9GeRSx2cRWsqb9b/odYnjSwC5e5Xj0Bp8HxE02J+VuGA7hf/r1xZ0nTycKsn4tV/StA0uacLcCTb7PisamDw/K3JM1eNzXENQh7NfedrL8U9HkhES218p7swXH86ybrxfpk27yp 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?
Reply With Quote
  #2 (permalink)  
Old 02-04-2008, 05:35 AM
Project Contributor
 
Posts: 106
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
Reply With Quote
  #3 (permalink)  
Old 02-04-2008, 02:26 PM
Zimbra Employee
 
Posts: 1,434
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!
Reply With Quote
  #4 (permalink)  
Old 02-04-2008, 11:50 PM
Project Contributor
 
Posts: 106
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 06:14 AM..
Reply With Quote
  #5 (permalink)  
Old 02-05-2008, 09:49 AM
Zimbra Employee
 
Posts: 1,434
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!
Reply With Quote
  #6 (permalink)  
Old 02-05-2008, 11:57 PM
Project Contributor
 
Posts: 106
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.