Java Soap Notification Example
Hi.
I try to connect our Spring App with Zimbra. I get ldap auth and calendar management working, but i don't find any infomations about the SOAP Notifications system.
I need notification events for new incoming mails on all accounts inside a domain.
To get all mailboxes i use this code
Code:
private List<ZMailbox> mailboxList = new ArrayList<ZMailbox>();
Code:
try {
SoapProvisioning spAdmin = new SoapProvisioning();
spAdmin.soapSetURI(adminURL);
spAdmin.soapAdminAuthenticate(this.username, this.password);
Domain domain = spAdmin.getDomainByName("mydomain.net");
List<Account> accounts = domain.getAllAccounts();
for (Account account : accounts) {
logger.debug("ACCOUNT: "+account.getName());
Options options = new Options(spAdmin.getAuthToken().getValue(), adminURL);
options.setTargetAccount(account.getName());
options.setTargetAccountBy(AccountBy.name);
ZMailbox mbox = new ZMailbox(options);
this.mailboxList.add(mbox);
}
} catch (ServiceException e) {
}
TimerTask for send NoOp request to keep soap session alive
Code:
Iterator<ZMailbox> mailboxIter = mailboxList.iterator();
while (mailboxIter.hasNext()) {
try {
ZMailbox mbox = mailboxIter.next();
mbox.noOp();
} catch (ServiceException e) {
e.printStackTrace();
}
}
but how can i get the notifications about new mails in each postbox?
greets Rizzi