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 02-08-2012, 08:31 AM
Special Member
 
Posts: 117
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.
Reply With Quote
  #2 (permalink)  
Old 03-16-2012, 08:27 AM
Elite Member
 
Posts: 469
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 ?
Reply With Quote
  #3 (permalink)  
Old 03-16-2012, 09:37 PM
Special Member
 
Posts: 117
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?
Reply With Quote
  #4 (permalink)  
Old 03-20-2012, 08:27 AM
Elite Member
 
Posts: 469
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);
            }
Reply With Quote
  #5 (permalink)  
Old 03-20-2012, 10:12 AM
Special Member
 
Posts: 117
Default

That means you have problem in response time not in response right?
Reply With Quote
  #6 (permalink)  
Old 03-20-2012, 01:40 PM
Elite Member
 
Posts: 469
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.
Reply With Quote
  #7 (permalink)  
Old 03-20-2012, 09:48 PM
Special Member
 
Posts: 117
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.
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.