This is what we are doing...
Code:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"></context>
</soap:Header>
<soap:Body>
<AuthRequest xmlns="urn:zimbraAccount">
<account by="name">youremail@com.com</account>
<preauth timestamp="XXXXX" expires="0">XXXXXXXXXXXXXXXXXXXXXXXX</preauth>
</AuthRequest>
</soap:Body>
</soap:Envelope>
This way you can connect (with preauth identificacion, so no userīs password is required).
The response is this way:
Code:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:zimbra">
<sessionId id="44">44</sessionId>
<refresh>
<mbx s="627"/>
<tags/>
<folder l="11" name="USER_ROOT" id="1">
<folder view="appointment" f="#" rest="http://localhost/home/youremail@com.com/Calendar/" l="1" name="Calendar" id="10"/>
<folder view="message" l="1" name="Chats" id="14"/>
<folder view="contact" rest="http://localhost/home/youremail@com.com/Contacts/" l="1" name="Contacts" id="7"/>
<folder view="message" l="1" name="Drafts" id="6"/>
<folder view="contact" rest="http://localhost/home/youremail@com.com/Emailed%20Contacts/" n="1" l="1" name="Emailed Contacts" id="13"/>
<folder view="message" n="1" l="1" name="Inbox" id="2"/>
<folder view="message" l="1" name="Junk" id="4"/>
<folder view="wiki" rest="http://localhost/home/youremail@com.com/Notebook/" l="1" name="Notebook" id="12"/>
<folder view="message" u="1" f="u" n="1" l="1" name="Sent" id="5"/>
<folder view="task" f="#" rest="http://localhost/home/youremail@com.com/Tasks/" l="1" name="Tasks" id="15"/>
<folder l="1" name="Trash" id="3"/>
</folder>
</refresh>
<change token="104"/>
</context>
</soap:Header>
<soap:Body>
<AuthResponse xmlns="urn:zimbraAccount">
<authToken>0_307762e8e2363c386f745ffd95e85df3ebf9adc3_69643d33363a32666236303338622d363735302d346131382d616665652d6335663735353330383934633b6578703d31333a313137343734363638333832323b</authToken>
<lifetime>172800000</lifetime>
<sessionId id="44">44</sessionId>
</AuthResponse>
</soap:Body>
</soap:Envelope>
so you can get unread messages this way: (Java)
Code:
//smAut is SOAPMessage with the response
NodeList vistas = smAut.getSOAPHeader().getElementsByTagName("folder");
int noLeidos =0;
for (int n=0; n<vistas.getLength();n++)
{
Node us = vistas.item(n).getAttributes().getNamedItem("u");
if (us!=null)
noLeidos += Integer.parseInt(us.getFirstChild().getNodeValue());
} Whith that unread messages can be read.
Our problem is now to use another command, when we send the authentication in AuthResponse, Zimbra always return SERVICE UNKNOWN. any help?