Results 1 to 7 of 7

Thread: WaitSet API explanation require

  1. #1
    stalker is offline Special Member
    Join Date
    Mar 2011
    Posts
    131
    Rep Power
    4

    Default WaitSet API explanation require

    Hello Everybody,

    I found very less information about WaitSet API of zimbra on internet. I just found this doc /opt/zimbra/docs/soap-waitset.txt. But it doesn't explain much about it.

    Can anybody explain me what is the use of WaitSet API and how it works?

    I would like to sync appointments as they changes.

    Thanks,
    stalker.

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

    Default

    Can anyone help out with this ?

    I have tried integrating this functionality, and find it very unreliable - but it may be because I am not calling it properly. For example - calling the api with a timeout of "30" and getting some responses after 24 seconds and others after 37 seconds - when nothing is changing on that mailbox.

    Anyone got a decent code sample for it's use ?

  3. #3
    stalker is offline Special Member
    Join Date
    Mar 2011
    Posts
    131
    Rep Power
    4

    Default

    Quote Originally Posted by liverpoolfcfan View Post
    Can anyone help out with this ?

    I have tried integrating this functionality, and find it very unreliable - but it may be because I am not calling it properly. For example - calling the api with a timeout of "30" and getting some responses after 24 seconds and others after 37 seconds - when nothing is changing on that mailbox.

    Anyone got a decent code sample for it's use ?
    There is no proper code snippet for it. Can you brief what exactly you're doing?

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

    Default

    I am calling the 3 Waitset SOAP functions in sequence within a php function.

    Basically, I am trying to wait for changes on an account - and then to parse through the changes to see if any relevant ones have occurred.

    But when I call the WaitSetRequest with a 30 second timeout - I am getting back responses in a very unpredictable manner. Sometimes too fast - other times too slow. No consistency.

    This is just an extract from the code where I built the calls to the WaitSet functions and parse the responses.

    It does not include the blocks of code that actually make the curl calls, and parse the XML, etc. but it should be enough for you to understand how I am trying to use the API.


    Code:
                $soap = '<CreateWaitSetRequest  defTypes="all" xmlns="urn:zimbraMail" >
                              <add><a id="'.$this->_zimbraId.'" /></add>
                         </CreateWaitSetRequest>';
    debugLog( 'CreateWaitSetRequest ['.$soap.']' );
    
                $response = $this->SoapRequest($soap);
                if($response) {
    
    debugLog( 'CreateWaitSetResponse: ' . print_r( $response, true ) );
    
                    $array = $this->MakeXMLTree($response);
    //debugLog( 'Response '.print_r( $array, true ) );
    
                    unset($response);
    				
                    $this->_pingtokenOne = $array['soap:Envelope'][0]['soap:Header'][0]['context'][0]['change'][0]['token'];
    debugLog( 'Token ['.$this->_pingtokenOne.']' );
    
                    $this->_waitSetId = $array['soap:Envelope'][0]['soap:Body'][0]['CreateWaitSetResponse'][0]['waitSet'];
                    $this->_highestSeqKnown = $array['soap:Envelope'][0]['soap:Body'][0]['CreateWaitSetResponse'][0]['seq'];
    debugLog( 'WaitSetResponse: SEQ [' .$this->_highestSeqKnown. ']' );
                }
    
    debugLog( "Calling WaitSetRequest for 30 seconds" );
    
                $soap = '<WaitSetRequest  waitSet="'.$this->_waitSetId.'" defTypes="all" seq="'.$this->_highestSeqKnown.'" block="1" timeout="'.$timeout.'" xmlns="urn:zimbraMail" >
                             <update>
                                 <a id="'.$this->_zimbraId.'" token="'.$this->_pingtokenOne.'" />
                             </update>   
                         </WaitSetRequest>';
    debugLog( 'WaitSetRequest ['.$soap.']' );
    
                $response = $this->SoapRequest($soap);
                if($response) {
    
    debugLog( 'WaitSetResponse ['.$this->_pingtokenOne.']: ' . print_r( $response, true ) );
    
                    $array = $this->MakeXMLTree($response);
    //debugLog( 'Array '. print_r( $array, true ) );
    
                    unset($response);
    				
                    $this->_highestSeqKnown = $array['soap:Envelope'][0]['soap:Body'][0]['WaitSetResponse'][0]['seq'];
    
    debugLog( 'WaitSetResponse: SEQ [' .$this->_highestSeqKnown. ']' );
                }
    
                $soap = '<DestroyWaitSetRequest  waitSet="'.$this->_waitSetId.'"  xmlns="urn:zimbraMail" />';
    debugLog( 'DestroyWaitSetRequest ['.$soap.']' );
    
                $response = $this->SoapRequest($soap);
                if($response) {
    
    debugLog( 'DestroyWaitSetResponse ['.$this->_pingtokenOne.']: ' . print_r( $response, true ) );
    
                    $array = $this->MakeXMLTree($response);
    //debugLog( 'Array '. print_r( $array, true ) );
    
                    unset($response);
                }

  5. #5
    stalker is offline Special Member
    Join Date
    Mar 2011
    Posts
    131
    Rep Power
    4

    Default

    That means you have problem in response time not in response right?

  6. #6
    liverpoolfcfan's Avatar
    liverpoolfcfan is offline Outstanding Member
    Join Date
    Oct 2009
    Location
    Dublin, IRELAND
    Posts
    712
    Rep Power
    6

    Default

    Actually, it seems like I did a disservice earlier.

    I have since added some more debugging to my code, and it turns out that the phone I am testing with is opening multiple simultaneous sessions with the server.

    Each of the sessions is behaving as it should as far as I can tell. Opening a WaitSet, waiting for the 30 seconds, then closing the WaitSet.

    Not sure why the multiple sessions are getting opened - but it is looking more promising than I first thought.

    The sequence of calls I have used appears to be good.

  7. #7
    stalker is offline Special Member
    Join Date
    Mar 2011
    Posts
    131
    Rep Power
    4

    Default

    Well, I've less idea about PHP's behavior of calling methods based on time interval. But you can also use javascript for that as well.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Google Translator Zimlet Updated to API v2
    By GregA in forum Zimlets
    Replies: 0
    Last Post: 12-06-2011, 09:25 AM
  2. Manaagement/Admin API?
    By hydrostarr in forum Administrators
    Replies: 2
    Last Post: 11-11-2011, 12:50 AM
  3. REST API over https?
    By greztok in forum Zimlets
    Replies: 2
    Last Post: 07-17-2011, 11:54 PM
  4. Spam training problem...
    By TaskMaster in forum Installation
    Replies: 2
    Last Post: 05-08-2007, 09:49 AM
  5. Where is the Indexing API document?
    By yuga in forum Developers
    Replies: 1
    Last Post: 03-04-2006, 11:59 AM

Posting Permissions

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