zimbra-api / soap-api

Zimbra SOAP client in PHP language
BSD 3-Clause "New" or "Revised" License
62 stars 48 forks source link

Error when using getAllAccounts #19

Closed pierosavi closed 5 years ago

pierosavi commented 7 years ago

I'm getting an error using getAllAccounts like this:

$mDomain = '*******';

$domain = new \Zimbra\Admin\Struct\DomainSelector(\Zimbra\Enum\DomainBy::VIRTUAL_HOSTNAME(), $mDomain);
$server = new \Zimbra\Admin\Struct\ServerSelector(\Zimbra\Enum\ServerBy::SERVICE_HOSTNAME(), $mDomain);

$myVar= $api->getallaccounts($domain, $server);

->getDomainInfo and ServerInfo are working correctly so that's not the problem. The error is the following:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ServerException' with message 'Server error:POST https://*************:7071/service/admin/soapresulted in a500 Server Errorresponse: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"><change tok (truncated...) ' in /var/www/ZimbraApi/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace: #0 /var/www/ZimbraApi/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 /var/www/ZimbraApi/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response)) #2 /var/www/ZimbraApi/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array) #3 /var/www/ZimbraApi/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Pro in /var/www/ZimbraApi/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

IlyasDeckers commented 7 years ago

Try this:

$server = new \Zimbra\Admin\Struct\ServerSelector(\Zimbra\Enum\ServerBy::NAME(), 'ZIMBRA_HOSTNAME');
$domain = new \Zimbra\Admin\Struct\DomainSelector(\Zimbra\Enum\DomainBy::NAME(), 'DOMAIN');