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 | * @var StreamFactoryInterface |
||
44 | */ |
||
45 | private $streamFactory; |
||
46 | /** |
||
47 | * @var RequestFactoryInterface |
||
48 | */ |
||
49 | private $requestFactory; |
||
50 | |||
51 | public function __construct(StreamFactoryInterface $streamFactory, RequestFactoryInterface $requestFactory) |
||
56 | |||
57 | /** |
||
58 | * @return RequestInterface |
||
59 | * @throws RequestException |
||
60 | */ |
||
61 | public function getSoapHttpRequest() |
||
74 | |||
75 | /** |
||
76 | * @param string $endpoint |
||
77 | * @return self |
||
78 | */ |
||
79 | public function setEndpoint($endpoint) |
||
84 | |||
85 | /** |
||
86 | * @return self |
||
87 | */ |
||
88 | public function isSOAP11() |
||
93 | |||
94 | public function isSOAP12() |
||
99 | |||
100 | |||
101 | /** |
||
102 | * @param string $soapAction |
||
103 | * @return self |
||
104 | */ |
||
105 | public function setSoapAction($soapAction) |
||
110 | |||
111 | /** |
||
112 | * @param StreamInterface $message |
||
113 | * @return self |
||
114 | */ |
||
115 | public function setSoapMessage(StreamInterface $message) |
||
121 | |||
122 | /** |
||
123 | * @param string $method |
||
124 | * @return self |
||
125 | */ |
||
126 | public function setHttpMethod($method) |
||
131 | |||
132 | private function validate() |
||
165 | |||
166 | /** |
||
167 | * @return array |
||
168 | */ |
||
169 | private function prepareHeaders() |
||
177 | |||
178 | /** |
||
179 | * @link https://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383526 |
||
180 | * @return array |
||
181 | */ |
||
182 | private function prepareSoap11Headers() |
||
190 | |||
191 | /** |
||
192 | * SOSPAction header is removed in SOAP 1.2 and now expressed as a value of |
||
193 | * an (optional) "action" parameter of the "application/soap+xml" media type. |
||
194 | * @link https://www.w3.org/TR/soap12-part0/#L4697 |
||
195 | * @return array |
||
196 | */ |
||
197 | private function prepareSoap12Headers() |
||
208 | |||
209 | /** |
||
210 | * @return StreamInterface |
||
211 | */ |
||
212 | private function prepareMessage() |
||
220 | |||
221 | private function unsetAll() |
||
232 | } |
||
233 |