Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: PHP SOAP vs Zimbra

  1. #11
    Join Date
    Sep 2007
    Rep Power


    how can i set both attribute and parameters at a time to a function call in PHP:
    Above in this post way to set attribute or param are discussed but not both at a time.
    i need this:
    <SearchRequest limit="10" offset="20">


  2. #12
    Join Date
    Jun 2008
    Rep Power

    Default License?

    Corey Scott,

    First of all, thank you for sharing this, it was very useful to me!

    I don't see any license information in the files. Do you plan to release it in a free license like the GPL ?

    In the meantime, is it possible for me to redistribute it ?
    I started building some functionality around your base class, and I would like to release my code with an open source license, and include your class for better ease of use.

    Thanks in advance,
    Last edited by skanx; 06-27-2008 at 06:23 AM.

  3. #13
    Join Date
    Oct 2007
    Ancaster Ontario Canada
    Rep Power


    Were you ever able to create a way to mass subscribe people in your company to your company Calendar? I'm looking to do a similar thing for our student calendar. Any help would be greatly appreciated!

    Quote Originally Posted by gettyless View Post
    Thanks for sharing your code - I can verify that it works in my test environment! Using your code, I can create a user programmatically through PHP and SOAP. For my test machine, I have win32 apache running - so I had to enable these extensions in my php.ini:

    I'd like to be able to quickly crank out scripts to do what I an across multiple account, for whatever features that aren't officially implemented yet .. if I really need that feature. For example, I'd like to auto-subscribe all employees to the company calendar.

    So, I will probably reuse the authentication code. I've rewritten it into an OO way not sure if it's the best way, design-wise, but it's a start:

    <form method="POST" action="soap.php">
    <input type="text" name="username"><br>
    <input type="text" name="password"><br>
    <input type="submit" name="submit" value="submit"><br>
    if (count($_POST))
        $password = $_POST['password'];
        $username = $_POST['username'];
        $ZimbraAuth = new ZimbraAuth($username, $password); 
        echo $ZimbraAuth->exec();
    class ZimbraAuth
        private $client; 
        private $params; 
        function __construct($username, $password)
            $this->client = new SoapClient(null,
                    'location' => "",
                    'uri' => "urn:zimbraAdmin",
                    'trace' => 1,
                    'exceptions' => 1,
                    'soap_version' => SOAP_1_1,
                    'style' => SOAP_RPC,
                    'use' => SOAP_LITERAL
            $this->params = array( new SoapParam($username, "name"), new SoapParam($password, "password") );
        function exec()
                //echo "creating header...<br>";
                $soapHeader = new SoapHeader('urn:zimbra','context');
                //echo "trying...<br>";        
                $result = $this->client->__soapCall("AuthRequest", $this->params, null,$soapHeader);
                //echo "executed...<br>";    
            catch (SoapFault $exception) 
                echo "exception caught!...<br><br>EXCEPTION START <<<<<<<<<<< <p>";
                echo $exception . "<br><br>";
                echo ">>>>>>>>>>>> EXCEPTION END<p>";
                echo htmlentities($client->__getLastRequest()) . "<br><br>";
                echo htmlentities($client->__getLastRequestHeaders()) . "<br><br>";
                echo htmlentities($client->__getLastResponseHeaders()) . "<br><br>";
                echo htmlentities($client->__getLastResponse()) . "<br><br>";
            //echo "authToken says: ".$result['authToken'] . "<br>";
            //echo "logged in, continuing<br>";
            return $result['authToken'];
    I'm guessing it would make sense to have a separate ZimbraAuth class, like how people often have a separate database authentication class. Then I use the token for something like $ZimbraUser->create($authToken) or $ZimbraUser->ChangePassword($old, $new, $authToken).

  4. #14
    Join Date
    Nov 2008
    Rep Power

    Default Access appointment in zimbra calendar

    I access the zimbra calendar and got the appointment. But it only returns the standard calendar appointment details. Not from other created calendars.

    <SearchRequest xmlns="urn:zimbraMail" types="appointment" calExpandInstStart="'.$datestart.'000" calExpandInstEnd="'.$dateend.'000">

  5. #15
    Join Date
    Feb 2011
    Rep Power


    Everyone was tearing their hair out back in 2006 about how to supply attributes to Zimbra SOAP function-name elements when Corey Scott saved the day:

    Quote Originally Posted by Corey Scott View Post
    Its a bit of a kludge (then again what about PHP SOAP isnt ) but I found a solution that works.

    Klude 2 (GetApptSummariesRequest):
    Intead of defining the function name:
    $strFunctionName = 'GetApptSummariesRequest';
    Sadly you need this instead:
    $strFunctionName = 'GetApptSummariesRequest s="' . $intTsStart . '" e="' . $intTsEnd . '"';
    You get the output you need.
    I've tried this trick for calling the SearchRequest function, which takes a 'type' attribute, but Corey's solution doesn't work for me.

    I have this for my __soapCall():

    $result = $client2->__soapCall(
        'SearchRequest type="contact"',         //  function name
        $params,                //  arguments
        null,                       //  options
        $soapHeader);        //  input headers
    But the XML that's produced dumbly repeats the attributes for the closing tag:

    <ns1:SearchRequest type="contact">
    </ns1:SearchRequest type="contact">
    Corey, anyone, how did you get this to work? How can one use PHP SOAP and attach XML attributes to the function-name element?

    Using Corey's SoapVar trick to attach attributes to *parameter* elements works fine. But I can't see how to do the same for the actual Zimbra functions which themselves require attributes.

    Many thanks for any tips!

Similar Threads

  1. [SOLVED] Clamav problem ? What's happening ?
    By aNt1X in forum Installation
    Replies: 23
    Last Post: 02-14-2008, 05:43 AM
  2. Replies: 8
    Last Post: 02-27-2007, 04:10 AM
  3. svn version still won't start
    By kinaole in forum Developers
    Replies: 0
    Last Post: 10-04-2006, 07:47 AM
  4. Logger
    By jholder in forum Installation
    Replies: 24
    Last Post: 03-31-2006, 11:50 AM
  5. Zimbra MTA and CentOS VPS on OpenVZ
    By czaveri in forum Installation
    Replies: 2
    Last Post: 03-20-2006, 09:42 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