Results 1 to 7 of 7

Thread: PHP Soap -> SearchRequest -> Appointment Problem

  1. #1
    Join Date
    Oct 2008
    Posts
    1
    Rep Power
    7

    Default PHP Soap -> SearchRequest -> Appointment Problem

    Hello,

    I have problems to get my appointments with the searchrequest.

    The Request is:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:zimbraMail" xmlns:ns2="urn:zimbra">
    <SOAP-ENV:Header>
    <ns2:context>
    <authToken>
    XXXXX</authToken>
    </ns2:context>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <ns1:SearchRequest types="appointment" calExpandInstStar="1193004000000" calExpandInstEnd="1256248799000" />
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    And the Response is
    Code:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
    <context xmlns="urn:zimbra">
    <sessionId id="1257174">
    1257174</sessionId>
    <refresh>
    <version>
    5.0.10_GA_2638.UBUNTU6 20081003035628 20081003-0401 NETWORK</version>
    <mbx s="32736373"/>
    <tags>
    <tag color="0" name="vxcv" id="64"/>
    </tags>
    <folder n="0" l="11" name="USER_ROOT" s="0" id="1" rev="1">
    <folder view="document" n="0" l="1" name="Briefcase" s="0" id="16" rev="1"/>
    <folder view="appointment" f="#" n="6" l="1" name="Calendar" s="23124" id="10" rev="1"/>
    <folder view="message" n="107" l="1" name="Chats" s="417871" id="14" rev="1"/>
    <folder view="message" f="*" n="174" l="1" name="commits" s="2332654" id="868" rev="1920"/>
    <folder view="contact" n="0" l="1" name="Contacts" s="0" id="7" rev="1"/>
    <folder view="message" f="*" n="18" l="1" name="Drafts" s="209496" id="6" rev="1"/>
    <folder view="contact" n="0" l="1" name="Emailed Contacts" s="0" id="13" rev="1"/>
    <folder view="message" n="194" l="1" name="Inbox" s="26284623" id="2" rev="1"/>
    <folder view="message" n="0" l="1" name="Junk" s="0" id="4" rev="1"/>
    <folder view="wiki" n="0" l="1" name="Notebook" s="0" id="12" rev="1"/>
    <folder view="message" f="*" n="53" l="1" name="Sent" s="3466801" id="5" rev="1"/>
    <folder view="task" f="#" n="1" l="1" name="Tasks" s="1740" id="15" rev="1"/>
    <folder n="0" l="1" name="Trash" s="0" id="3" rev="1"/>
    </folder>
    </refresh>
    <change token="2605"/>
    </context>
    </soap:Header>
    <soap:Body>
    <SearchResponse more="0" sortBy="dateDesc" offset="0" xmlns="urn:zimbraMail"/>
    </soap:Body>
    </soap:Envelope>
    I'm sure that there are appointments. But why he doesn't show them?
    P.S. The old GetApptSummariesRequest returns the same.

    Thank you in advance,

    Daniel

  2. #2
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Default

    http://blog.xenco.be/wp-content/uplo...soap-admin.txt
    -----------------------------
    <SearchGalRequest [type="{type}"]>
    <name>...</name>
    </SearchGalRequest>

    <SearchGalResponse more="{more}" [tokenizeKey="{tokenize-key-op}"]>
    <cn>...</cn>*
    </SearchGalResponse>

    {more-flag} = 1 if the results were truncated.

    {tokenize-key-op} = and|or
    - Not present if the search key was not tokenized.
    - Some clients backtrack on GAL results assuming the results of a more
    specific key is the subset of a more generic key, and it checks cached
    results instead of issuing another SOAP request to the server.
    If search key was tokenized and expanded with AND or OR, this cannot
    be assumed.

    {type} = type of addresses to search
    "account" for regular user accounts, aliases and distribution lists
    "resource" for calendar resources
    "all" for combination of both types
    if omitted, defaults to "all"
    use zimbra_search_gal(..) with my modification
    Code:
    function zimbra_search_gal($name,$domain,$type = "all") {
    		$xml = new xml2Array();
    		$this->set_zimbra_header();
    		$soapmessage = $this->soapheader . '
    		<SearchGalRequest xmlns="urn:zimbraAdmin" domain="'.$domain.'" type="'.$type.'">
    		<name>' . $name . '</name>
    		</SearchGalRequest>
    		</soap:Body>
    		</soap:Envelope>';
    
    		curl_setopt($this->curlhandle, CURLOPT_POSTFIELDS, $soapmessage);
    		if (!($zimbraSOAPResponse = curl_exec($this->curlhandle))) {
    			$this->zimbraerrno = curl_errno($this->curlhandle);
    			$this->zimbraerror = curl_error($this->curlhandle);
    			return false;
    		}
    
    		$res = $xml->parse($zimbraSOAPResponse);
    		if (isset ($res['SOAP:ENVELOPE']['SOAP:BODY']['SEARCHGALRESPONSE']))
    			return $res['SOAP:ENVELOPE']['SOAP:BODY']['SEARCHGALRESPONSE'];
    		return false;
    	}
    How does it right reponse for you ?
    ...

  3. #3
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    6

    Default

    I am seeing the same behavior. SearchRequest seems to be able to return emails between a specified date just fine, but other types such as tasks and appointments don't seem to have any returned results in SearchResponse. Is this is bug or are we just missing something?

  4. #4
    Join Date
    May 2009
    Posts
    4
    Rep Power
    6

    Default

    From looking at the dev debug mode, it seems that zimbra passes the query "inid:13" which I assume is the calendar id. I think you get it from the refresh or elsewhere.

  5. #5
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    5

    Default

    I have the same strange behaviour with zimbra 5.0.11, with a json query:
    the body of the reply is empty after a SearchRequest on type "appointment".

  6. #6
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    5

    Default

    here is the json query (javascript):

    { "Header": { "context": { "_jsns": "urn:zimbra", "authToken": { "_content": "' + Net.soapAuthToken + '" } }, "format": { "type": "js" } }, "Body":{ "SearchRequest": { "_jsns":"urn:zimbraMail", "sortBy":"dateAsc", "types": "appointment", "fetch": "all", "offset":"' + calOffset + '"; "limit": "30", "calExpandInstStart": "' + Math.floor(StartTime.getTime() / 1000) + '", "calExpandInstEnd": "' + Math.floor(EndTime.getTime() / 1000) + '" } } }

    and here is the response:

    {"Body":{"SearchResponse":{"more":false,"sortBy":" dateAsc","offset":0,"_jsns":"urn:zimbraMail"}},"He ader":{....etc.... }}

  7. #7
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    5

    Default

    OK, to get the appointments, i must provide a calendar folder id in the query:
    ... "query": { "_content": "inid:10" } } } }
    or xml:
    ...
    <query>
    inid:10
    </query>
    </SearchRequest>

Similar Threads

  1. [SOLVED] Simple SOAP Admin Example In PHP
    By mikes2277 in forum Developers
    Replies: 11
    Last Post: 07-23-2011, 01:00 AM
  2. PHP SOAP create appointment example
    By AddGun in forum Developers
    Replies: 13
    Last Post: 09-27-2010, 04:41 PM
  3. [SOLVED] php soap to add appointment in calendar
    By underdog in forum Developers
    Replies: 2
    Last Post: 09-18-2008, 06:08 AM
  4. Replies: 0
    Last Post: 07-08-2008, 03:01 PM
  5. [SOLVED] Upgraded to 5.0 OSS - Sendmail Problem
    By Chewie71 in forum Installation
    Replies: 11
    Last Post: 12-28-2007, 06:07 PM

Posting Permissions

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