1 | <?php |
||
13 | class RequestBuilder |
||
14 | { |
||
15 | const SOAP11 = '1.1'; |
||
16 | const SOAP12 = '1.2'; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $endpoint; |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $soapVersion = self::SOAP11; |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $soapAction = ''; |
||
30 | /** |
||
31 | * @var StreamInterface |
||
32 | */ |
||
33 | private $soapMessage; |
||
34 | /** |
||
35 | * @var bool |
||
36 | */ |
||
37 | private $hasSoapMessage = false; |
||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $httpMethod = 'POST'; |
||
42 | |||
43 | private $streamFactory; |
||
44 | |||
45 | private $requestFactory; |
||
46 | |||
47 | public function __construct(StreamFactoryInterface $streamFactory, RequestFactoryInterface $requestFactory) |
||
52 | |||
53 | /** |
||
54 | * @return RequestInterface |
||
55 | * @throws RequestException |
||
56 | */ |
||
57 | public function getSoapHttpRequest() |
||
70 | |||
71 | /** |
||
72 | * @param string $endpoint |
||
73 | * @return self |
||
74 | */ |
||
75 | public function setEndpoint($endpoint) |
||
80 | |||
81 | /** |
||
82 | * @return self |
||
83 | */ |
||
84 | public function isSOAP11() |
||
89 | |||
90 | public function isSOAP12() |
||
95 | |||
96 | |||
97 | /** |
||
98 | * @param string $soapAction |
||
99 | * @return self |
||
100 | */ |
||
101 | public function setSoapAction($soapAction) |
||
106 | |||
107 | /** |
||
108 | * @param StreamInterface $message |
||
109 | * @return self |
||
110 | */ |
||
111 | public function setSoapMessage(StreamInterface $message) |
||
117 | |||
118 | /** |
||
119 | * @param string $method |
||
120 | * @return self |
||
121 | */ |
||
122 | public function setHttpMethod($method) |
||
127 | |||
128 | private function validate() |
||
161 | |||
162 | /** |
||
163 | * @return array |
||
164 | */ |
||
165 | private function prepareHeaders() |
||
173 | |||
174 | /** |
||
175 | * @link https://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383526 |
||
176 | * @return array |
||
177 | */ |
||
178 | private function prepareSoap11Headers() |
||
186 | |||
187 | /** |
||
188 | * SOSPAction header is removed in SOAP 1.2 and now expressed as a value of |
||
189 | * an (optional) "action" parameter of the "application/soap+xml" media type. |
||
190 | * @link https://www.w3.org/TR/soap12-part0/#L4697 |
||
191 | * @return array |
||
192 | */ |
||
193 | private function prepareSoap12Headers() |
||
204 | |||
205 | /** |
||
206 | * @return StreamInterface |
||
207 | */ |
||
208 | private function prepareMessage() |
||
216 | |||
217 | private function unsetAll() |
||
228 | } |
||
229 |