-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSoapClientWrapper.php
32 lines (26 loc) · 945 Bytes
/
SoapClientWrapper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
class SoapClientWrapper
{
private $options;
private $client;
public function __construct(array $options)
{
$this->options = $options;
$this->client = new SoapClient(null, $this->options);
$this->client->__setOptions($this->options);
}
public function authenticate(string $username, string $password)
{
$header = new SoapHeader($this->options['location'], 'Authenticate', array('username' => $username, 'password' => $password));
$this->client->__setSoapHeaders($header);
}
public function getData()
{
try {
$result = $this->client->__soapCall('GetData', array());
return $this->client->__getLastResponse();
} catch (Exception $e) {
throw new Exception("Error Processing Request", 1);
}
}
}