Exemplo n.º 1
0
 * You have to use an associative array such as:
 * - the key must be a constant beginning with WSDL_ from AbstractSoapClientbase class each generated ServiceType class extends this class
 * - the value must be the corresponding key value (each option matches a {@link http://www.php.net/manual/en/soapclient.soapclient.php} option)
 * $options = array(
 * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => __DIR__ . '/wsdl/services.wsdl',
 * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => true,
 * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN => 'you_secret_login',
 * \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD => 'you_secret_password',
 * );
 * etc....
 */
require_once __DIR__ . '/vendor/autoload.php';
/**
 * Minimal options
 */
$options = array(\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => __DIR__ . '/wsdl/services.wsdl', \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \Ews\EwsClassMap::get());
/**
 * Samples for Resolve ServiceType
 */
$resolve = new \Ews\ServiceType\EwsResolve($options);
$resolve->setSoapHeaderExchangeImpersonation($ExchangeImpersonation);
$resolve->setSoapHeaderMailboxCulture($MailboxCulture);
$resolve->setSoapHeaderRequestServerVersion(new \Ews\StructType\EwsRequestServerVersion());
/**
 * Sample call for ResolveNames operation/method
 */
if ($resolve->ResolveNames(new \Ews\StructType\EwsResolveNamesType()) !== false) {
    print_r($resolve->getResult());
} else {
    print_r($resolve->getLastError());
}
 */
use WsdlToPhp\PackageBase\AbstractSoapClientBase;
use Ews\EnumType\EwsExchangeVersionType;
use Ews\EwsClassMap;
/**
 * Your Office 365 login, like {id}@{id}.onmicrosoft.com
 */
define('EWS_WS_LOGIN', '');
/**
 * Your Office 365 passowrd
 */
define('EWS_WS_PASSWORD', '');
/**
 * Minimal options in order to instanciate the ServiceType named Get
 */
$options = array(AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../wsdl/services.wsdl', AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(), AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN, AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD);
/**
 * Instanciation of the ServiceType get that gather all the operations beginnig with "get".
 */
$get = new \Ews\ServiceType\EwsGet($options);
/**
 * Configure the SoapHeader, each header's method begins with "setSoapHeader".
 */
$get->setSoapHeaderRequestServerVersion(new \Ews\StructType\EwsRequestServerVersion(EwsExchangeVersionType::VALUE_EXCHANGE_2013_SP_1));
/**
 * Send the request, you can customize the request by modifiying the new \Ews\StructType\EwsGetServerTimeZonesType() instance
 */
$result = $get->GetServerTimeZones(new \Ews\StructType\EwsGetServerTimeZonesType());
/**
 * Debug informations provided by the utility methods
 */