Я уже ищу везде, но не могу найти решение своей проблемы.
Я пытаюсь подключиться к API, но я получаю эту ошибку "похоже, у нас нет документа XML».
Я отправил электронное письмо компании, которая создает API, и они сказали, что проблема была в моем сервере.Я пробовал также в местной среде, но это та же проблема.
Код:
<code> $soap = new soapclient( $WS_URL, array('trace' => 1, 'exceptions' => 0));
$result = $soap->authenticate( $API_KEY );
$APISession = $result[1];
try {
echo '<pre>';
var_dump($soap);
echo '
';} catch (Exception $ e) {echo ($ soap -> __ getLastResponse ());echo PHP_EOL;echo ($ soap -> __ getLastRequest ());} // 140 - Номер документа // 4 - Тип документа $ getdocumentpdflink = $ soap-> getdocumentpdflink ($ APISession, 140, 4);echo '
';
print_r($getdocumentpdflink);
echo '
';умереть;
Ответ:
C:\wamp64\www\soap\index.php:13:
object(SoapClient)[1]
public 'trace' => int 1
public '_exceptions' => boolean false
public '_soap_version' => int 1
public 'sdl' => resource(2, SOAP SDL)
public '__last_request' => string '<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:KI_API3" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:authenticate><apikey xsi:type="xsd:string">464nbbp2189cf9b8de9a39bd6aa9cdc80fd41a7</apikey></ns1:authenticate></SOAP-ENV:Body>'... (length=533)
public 'httpsocket' => resource(3, stream)
public '_use_proxy' => int 0
public 'httpurl' => resource(4, SOAP URL)
public '__last_request_headers' => string 'POST /API3_ws.php HTTP/1.1
Host: iniciar.netfacturacion.es
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.0.0
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:KI_API3#authenticate"
Content-Length: 533
' (length=215)
public '__last_response_headers' => string 'HTTP/1.1 200 OK
Date: Fri, 25 Jan 2019 14:41:54 GMT
Content-Type: text/xml; charset=ISO-8859-1
Content-Length: 663
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type
Set-Cookie: PHPSESSID=3no7p09ctpm9de911c73p30cs5; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Server: NuSOAP Server v0.9.5
X-SOAP-Server: NuS'... (length=531)
public '_cookies' =>
array (size=1)
'PHPSESSID' =>
array (size=3)
0 => string '3no7p09ctpm9de911c73p30cs5' (length=26)
1 => string '/' (length=1)
2 => string 'iniciar.netfacturacion.es' (length=25)
public '__last_response' => string '<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:authenticateResponse xmlns:ns1="urn:KI_API3"><return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2]"><item xsi:type="xsd:string">1</i'... (length=663)
SoapFault Object
(
[message:protected] => looks like we got no XML document
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => C:\wamp64\www\soap\index.php
[line:protected] => 22
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => C:\wamp64\www\soap\index.php
[line] => 22
[function] => __call
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => getdocumentpdflink
[1] => Array
(
[0] => 053017969afdc9f800000464a661e0975230f437
[1] => 140
[2] => 4
)
)
)
)
[previous:Exception:private] =>
[faultstring] => looks like we got no XML document
[faultcode] => Client
[faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
)
Не понимаю, в чем может быть проблема.
Заранее спасибо.
С уважением!