1 | <?php |
||
12 | trait SoapManager |
||
13 | { |
||
14 | use ArrayManager; |
||
15 | |||
16 | /** |
||
17 | * URL of WSDL service to consume. |
||
18 | * |
||
19 | * @var string|null $wsdl |
||
20 | */ |
||
21 | private $wsdl; |
||
22 | /** |
||
23 | * Set of options for SOAP request. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | private $options = []; |
||
28 | /** |
||
29 | * Response of SOAP method. |
||
30 | * |
||
31 | * @var mixed |
||
32 | */ |
||
33 | private $response; |
||
34 | /** |
||
35 | * Last SOAP response. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | private $rawResponse = ''; |
||
40 | /** |
||
41 | * The URIs of the namespaces. |
||
42 | * |
||
43 | * @var string[] |
||
44 | */ |
||
45 | private $namespaces = []; |
||
46 | |||
47 | /** |
||
48 | * @var \SoapFault|null |
||
49 | */ |
||
50 | private $exception; |
||
51 | |||
52 | /** |
||
53 | * Make SOAP call to a function with params. |
||
54 | * |
||
55 | * @param string $function |
||
56 | * SOAP function name to execute. Use MethodNameIsIgnored if function name is in the XML body. |
||
57 | * @param array $arguments |
||
58 | * Arguments array to pass to soap call function. |
||
59 | */ |
||
60 | protected function sendRequest($function, array $arguments) |
||
80 | |||
81 | /** |
||
82 | * Extracts first value matching provided XPATH expression. |
||
83 | * |
||
84 | * @param string $query |
||
85 | * XPATH expression used to extract value from $this->rawResponse |
||
86 | * |
||
87 | * @return \DOMNode|bool |
||
88 | */ |
||
89 | protected function extractResponseValueMatchingXPATH($query) |
||
105 | |||
106 | /** |
||
107 | * Helper to extract a property value from the response. |
||
108 | * |
||
109 | * @param string $property |
||
110 | * |
||
111 | * @return mixed |
||
112 | */ |
||
113 | protected function extractResponseProperty($property) |
||
117 | |||
118 | /** |
||
119 | * @param string $wsdl |
||
120 | */ |
||
121 | 4 | protected function setWSDL($wsdl) |
|
133 | |||
134 | /** |
||
135 | * @param array $options |
||
136 | */ |
||
137 | protected function setOptions(array $options = null) |
||
147 | |||
148 | /** |
||
149 | * @param string $option |
||
150 | * @param mixed $value |
||
151 | */ |
||
152 | protected function setOption($option, $value) |
||
156 | |||
157 | /** |
||
158 | * @param array $namespaces |
||
159 | */ |
||
160 | protected function setNamespaces(array $namespaces = null) |
||
170 | |||
171 | /** |
||
172 | * @param string $prefix |
||
173 | * @param string $uri |
||
174 | */ |
||
175 | protected function setNamespace($prefix, $uri) |
||
179 | |||
180 | /** |
||
181 | * @return \SoapFault |
||
182 | */ |
||
183 | public function getException() { |
||
186 | |||
187 | /** |
||
188 | * @param \SoapFault $exception |
||
189 | */ |
||
190 | public function setException(\SoapFault $exception = null) { |
||
193 | } |
||
194 |