1 | <?php |
||
40 | class NTLMSoapClient extends SoapClient |
||
41 | { |
||
42 | /** |
||
43 | * Username for authentication on the exchnage server |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $user; |
||
48 | |||
49 | /** |
||
50 | * Password for authentication on the exchnage server |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $password; |
||
55 | |||
56 | /** |
||
57 | * Whether or not to validate ssl certificates |
||
58 | * |
||
59 | * @var boolean |
||
60 | */ |
||
61 | protected $validate = false; |
||
62 | |||
63 | private $httpClient; |
||
64 | |||
65 | protected $__last_request_headers; |
||
66 | |||
67 | protected $_responseCode; |
||
68 | |||
69 | /** |
||
70 | * An array of headers for us to store or use. Since not all requests use all headers (DeleteItem and SyncItems |
||
71 | * don't allow you to pass a Timezone for example), we need to be able to smartly decide what headers to include |
||
72 | * and exclude from a request. Until we have propper selection (an array of all known operations and what headers |
||
73 | * are allowed for example), this seems like a decent solution for storing the headers before we decide if they |
||
74 | * belong in the request or not) |
||
75 | * |
||
76 | * @var array |
||
77 | */ |
||
78 | protected $ewsHeaders = array( |
||
79 | 'version' => null, |
||
80 | 'impersonation' => null, |
||
81 | 'timezone' => null |
||
82 | ); |
||
83 | |||
84 | protected $auth; |
||
85 | |||
86 | protected $callsWithoutTimezone = array( |
||
87 | 'DeleteItem', |
||
88 | 'SyncFolderItems', |
||
89 | 'GetServerTimeZones', |
||
90 | 'ConvertId', |
||
91 | 'MoveItem' |
||
92 | ); |
||
93 | |||
94 | /** |
||
95 | * @TODO: Make this smarter. It should know and search what headers to remove on what actions |
||
96 | * |
||
97 | * @param string $name |
||
98 | * @param string $args |
||
99 | * @return mixed |
||
100 | */ |
||
101 | 30 | public function __call($name, $args) |
|
121 | |||
122 | /** |
||
123 | * @param string $location |
||
124 | * @param string $wsdl |
||
125 | * @param array $options |
||
126 | */ |
||
127 | 38 | public function __construct($location, $auth, $wsdl, $options = array()) |
|
177 | |||
178 | /** |
||
179 | * Performs a SOAP request |
||
180 | * |
||
181 | * @link http://php.net/manual/en/function.soap-soapclient-dorequest.php |
||
182 | * |
||
183 | * @param string $request the xml soap request |
||
184 | * @param string $location the url to request |
||
185 | * @param string $action the soap action. |
||
186 | * @param integer $version the soap version |
||
187 | * @param integer $one_way |
||
188 | * @return string the xml soap response. |
||
189 | */ |
||
190 | 30 | public function __doRequest($request, $location, $action, $version, $one_way = 0) |
|
224 | |||
225 | /** |
||
226 | * Returns last SOAP request headers |
||
227 | * |
||
228 | * @link http://php.net/manual/en/function.soap-soapclient-getlastrequestheaders.php |
||
229 | * |
||
230 | * @return string the last soap request headers |
||
231 | */ |
||
232 | public function __getLastRequestHeaders() |
||
236 | |||
237 | /** |
||
238 | * Set validation certificate |
||
239 | * |
||
240 | * @param bool $validate |
||
241 | * @return $this |
||
242 | */ |
||
243 | 1 | public function validateCertificate($validate = true) |
|
249 | |||
250 | /** |
||
251 | * Returns the response code from the last request |
||
252 | * |
||
253 | * @return integer |
||
254 | */ |
||
255 | 30 | public function getResponseCode() |
|
259 | } |
||
260 |