This repository was archived by the owner on Apr 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSoapBehavior.php
More file actions
47 lines (37 loc) · 1.31 KB
/
SoapBehavior.php
File metadata and controls
47 lines (37 loc) · 1.31 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @author hofrob
*/
class SoapBehavior extends CBehavior {
private $__soapClient;
public function getSoapClient() {
if(empty($this->__soapClient)) {
if(function_exists('xdebug_disable'))
@xdebug_disable();
try {
$this->__soapClient = @new SoapClient($this->owner->wsdl, $this->owner->config);
} catch(SoapFault $e) {
Yii::log(__METHOD__.' No connection to SoapService: '.$e->getMessage()."\n\n".
CVarDumper::dumpAsString($this->owner), 'warning', 'soap.behavior');
}
}
return $this->__soapClient;
}
public function soapRequest($method, $request) {
if(empty($this->soapClient))
return array('success' => false);
try {
$ret = $this->soapClient->$method($request);
$success = true;
} catch(SoapFault $e) {
Yii::log(__METHOD__.' soapRequest failed: '.$e->getMessage()."\n\n".
'$method: '.CVarDumper::dumpAsString($method)."\n\n".
'$request: '.CVarDumper::dumpAsString($request), 'warning', 'soap.behavior');
$success = false;
}
return array(
'success' => $success,
'wsReturn' => $ret,
);
}
}