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 05-18-2010, 07:03 AM
Beginner Member
 
Posts: 2
Default ZClient - ZMailbox.getAppointment - not working?

Hi all,

I'm trying to build a custom stand-alone client application that accesses my zimbra server. Right now I'm stuck accessing my appointments.

ZMailBox.getApptSummaries(...) seems to work as expected and returns a result, which then leads to ZAppointmentHit-objects. Using the Appointment-id from the ZAppointmentHit-objects to call ZMailbox.getAppointment(<id>) fails:

Code:
com.zimbra.common.service.ServiceException: invalid request: missing required attribute: id
ExceptionId:main:1274190891873:4d761470c98badd4
Code:service.INVALID_REQUEST
        at com.zimbra.common.service.ServiceException.INVALID_REQUEST(ServiceException.java:255)
        at com.zimbra.common.soap.Element.checkNull(Element.java:238)
        at com.zimbra.common.soap.Element.getAttribute(Element.java:206)
        at com.zimbra.cs.zclient.ZCalendarItem.<init>(ZCalendarItem.java:71)
        at com.zimbra.cs.zclient.ZAppointment.<init>(ZAppointment.java:24)
        at com.zimbra.cs.zclient.ZMailbox.getAppointment(ZMailbox.java:4259)
        at zclienttest01.Main.main(Main.java:88)
Stepping into these functions my debugger shows, that ZMailbox.getAppointment(...) builds some kind of request and passes it to invoke(...). invoke(...) returns a com.zimbra.common.soap.Element$JSonElement-object which does contain the Appointment I'm looking for (and it does contain the id-field!).

Using that JSonElement, ZMailbox tries to call the ZAppointment-constructor which in turn will eventually try to call getAttribute on the Element.

It seems to me, as if the getAttribute-function does not really know about the JSonElement-subclass and fails to handle it correctly.


So is this my fault or is it a bug?

(Am I even supposed to use ZClient for stand-alone apps (I think I read that a couple of times here on the forums)? Or should I write my own code to access the webservices offered by zimbra?)
Reply With Quote
  #2 (permalink)  
Old 05-18-2010, 07:30 AM
Beginner Member
 
Posts: 2
Default

Btw, I've worked around it for now by copying and adapting the getAppointment-function:

Code:
public static ZAppointment myGetAppointment(ZMailbox zmb, String id) throws ServiceException {
    Element req = zmb.newRequestElement(MailConstants.GET_APPOINTMENT_REQUEST);
    req.addAttribute(MailConstants.A_ID, id);
    req.addAttribute(MailConstants.A_SYNC, true);
    JSONElement je = (JSONElement) zmb.invoke(req);
    return new ZAppointment(je.getElement("appt"));
}
Reply With Quote
  #3 (permalink)  
Old 09-01-2010, 03:33 AM
Starter Member
 
Posts: 2
Default

Had the same problem. Thanks.
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.