Results 1 to 5 of 5

Thread: Help with AdminCreateWaitSet

  1. #1
    Tim J. is offline New Member
    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    1

    Default Help with AdminCreateWaitSet

    My goal is to query changes made to appointments in real-time. I am trying to feed notifications to a third party system. So far, my plan has been to issue AdminCreateWaitSet, and then poll for new updates (changes) with AdminWaitSet. All seems to be working well, with ID's being returned as data changes. So, here is my problem, where is the data? I am getting an ID returned with AdminWaitSet, but I do not what additional call I can make to get a list of the data that has changed. Can anyone tell me how to retrieve the data that has changed? Example: New appointments, changes to appointments, etc. Should I even be using WaitSets? Is there some other way. I am communicating with Zimbra via SOAP calls from PHP, it that helps.

    Thanks in advance,

    Tim J.

  2. #2
    liverpoolfcfan's Avatar
    liverpoolfcfan is online now Outstanding Member
    Join Date
    Oct 2009
    Location
    Dublin, IRELAND
    Posts
    710
    Rep Power
    6

    Default

    Not sure about the Admin version - but if you are just looking for a calendar you have access to then CreateWaitSet will do it.

    You need to start a session during your AuthRequest - and when the WaitSet returns you should get a notify block in the header section of the response. This will tell you everything that changed.

    I use it in the zimbra backend for z-push to trigger pushes to the mobile devices. You can check out the code - it might help you. Look for the functions related to ChangesSink - there are a number. Code is in sourceforge - Z-Push Zimbra Backend / Code / [r185] /zimbra-backend/branches/z-push-2

  3. #3
    Tim J. is offline New Member
    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    1

    Default

    liverpoolfcfan,

    Thank you for your help. The code that you referred me to, is exactly what I need. Can you tell me, How do you flag a folder for the notifications? I ask, because when I get back my waitSet, I am not getting back the notification data in the header section.

    I really appreciate your help. Thank you.

    Tim J.

  4. #4
    liverpoolfcfan's Avatar
    liverpoolfcfan is online now Outstanding Member
    Join Date
    Oct 2009
    Location
    Dublin, IRELAND
    Posts
    710
    Rep Power
    6

    Default

    The key in in the AuthRequest. You have to set the session and notify options in the request header. The session parameter signals that you want to open and maintain an active session on the server - as opposed to a single request and done. The notify seq tells zimbra to report all changes since the notify seq number provided in the header of the response. Note - the format option allows you to request json returns instead of the default XML.

    Code:
            // Login To Zimbra
    		if ($this->_smartFolders) {
                $header  = '<context xmlns="urn:zimbra">
                                <session id="" />
                                <notify  seq="0" />
                                <format type="js" /> 
                            </context>';
                $returnJSON = true;
            } else { // Not updating old XML code to use JSON
                $header  = '<context xmlns="urn:zimbra">
                                <session id="" />
                                <notify  seq="0" />
                            </context>';
                $returnJSON = false;
                ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->Logon(): ' .  'ReturnJSON = false');		   
            }
            $body    = '<AuthRequest xmlns="urn:zimbraAccount">
                            <account by="name">'.$this->_username.'</account>
                            <password>'.$this->_password.'</password>
                            <attrs><attr name="uid"/></attrs>
                            <prefs><pref name="zimbraPrefTimeZoneId"/></prefs>
                        </AuthRequest>';
    
    
            $response = $this->SoapRequest($body, $header, true, $returnJSON);

  5. #5
    Tim J. is offline New Member
    Join Date
    Aug 2013
    Posts
    3
    Rep Power
    1

    Default

    liverpoolfcfan,

    Once again, Thank you for your insights. My goal is to create a PHP script that will run about every 10 minutes, look for changes to calendars or appts, and then take that information and send it to another system. So, if I have this correct, my script will login (creating a session), create a waitset, then wait on the waitset (blocking), and read the info when the waitSet returns.

    My question is this, When does the tracking of changes start? It seems that this is all inside a session, but what if the session gets closed? What happens to any changes that occur before a new session starts? Or, is the session really not as important as the changeToken value and that is what keeps track of the changes?

    Sorry to bug you, I am just trying to get the "flow" of the processes.

    I am reading your code, and am developing some testing routines. If you have any quick notes that you think could help me, I greatly appreciate your time.

    Thank You,

    Tim J.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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