1 | <?php |
||
25 | class SoapCurl extends SoapBase implements SoapInterface |
||
26 | { |
||
27 | /** |
||
28 | * Constructor |
||
29 | * @param Certificate $certificate |
||
30 | * @param LoggerInterface $logger |
||
31 | */ |
||
32 | public function __construct(Certificate $certificate = null, LoggerInterface $logger = null) |
||
36 | |||
37 | /** |
||
38 | * Send soap message to url |
||
39 | * @param string $url |
||
40 | * @param string $operation |
||
41 | * @param string $action |
||
42 | * @param int $soapver |
||
43 | * @param array $parameters |
||
44 | * @param array $namespaces |
||
45 | * @param string $request |
||
46 | * @param \SoapHeader $soapheader |
||
47 | * @return string |
||
48 | * @throws \NFePHP\Common\Exception\SoapException |
||
49 | */ |
||
50 | public function send( |
||
69 | |||
70 | public function send2(SoapData $data): string |
||
71 | { |
||
72 | $parameters = self::buildParameters($data); |
||
73 | $this->requestHead = implode('\n', $parameters); |
||
74 | $this->requestBody = $data->envelopedData; |
||
75 | |||
76 | $url = $data->urlService; |
||
77 | |||
78 | $httpcode = 0; |
||
79 | try { |
||
80 | $curl = $this->create_curl($url, $data->envelopedData, $parameters); |
||
|
|||
81 | |||
82 | $response = curl_exec($curl); |
||
83 | |||
84 | $httpcode = $this->dispose_curl($curl, $response, $data->urlMethod); |
||
85 | } catch (\Exception $e) { |
||
86 | throw SoapException::unableToLoadCurl($e->getMessage()); |
||
87 | } |
||
88 | |||
89 | if ($this->soaperror != '') { |
||
90 | throw SoapException::soapFault($this->soaperror . " [$url]"); |
||
91 | } |
||
92 | |||
93 | if ($httpcode != 200) { |
||
94 | throw SoapException::soapFault(" [$url]" . $this->responseHead); |
||
95 | } |
||
96 | |||
97 | return $this->responseBody; |
||
98 | } |
||
99 | |||
100 | private static function buildParameters(SoapData $data): array |
||
101 | { |
||
102 | $msgSize = strlen($data->envelopedData); |
||
103 | $parameters = array( |
||
104 | "Content-Type: $data->contentType;charset=\"utf-8\"", |
||
105 | "Content-Length: $msgSize", |
||
106 | ); |
||
107 | if (!empty($data->urlMethod)) { |
||
108 | $parameters[0] .= ";action=\"$data->urlMethod\""; |
||
109 | } |
||
110 | if (!empty($data->urlAction)) { |
||
111 | $parameters[] = "SOAPAction: $data->urlAction"; |
||
112 | } |
||
113 | return $parameters; |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Set proxy into cURL parameters |
||
118 | * @param resource $oCurl |
||
119 | */ |
||
120 | private function setCurlProxy(&$oCurl) |
||
132 | |||
133 | private function createCurl($url, $envelope, $parameters) |
||
172 | |||
173 | private function disposeCurl($oCurl, $response, $operation = '') |
||
199 | } |
||
200 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.