Я хочу получить значение ошибки из xml. Я использую Laravel 5.7, чтобы получить это. Я попробовал это, но я не получаю то, что я хочу.
Это мое xml сообщение об ошибке:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Client Error</faultstring>
<detail>
<ResponseStatus>F</ResponseStatus>
<ResponseCode>000</ResponseCode>
<ResponseText>Error while executing the request:
ApplicationError: (Server Message)
Category: 9
Number: 261
Call Sequence:
Program Name:
Text: Characteristic Type MCMX Characteristic Value BRACET combination, not found
Description: To solve the problem, check if the fields are populated, or the combination of them is a valid one to find an item in a table.
</ResponseText>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Я хочу получить ошибку значения в имени тега <ResponseText> => Text
. Я пробовал это, как мой код ниже:
$res = $response->getBody()->getContents();
$doc = new \DOMDocument();
$doc->loadXML($res);
$status = $doc->getElementsByTagName('ResponseText');
print_r($status);
Я получил результат print_r следующим образом:
DOMNodeList Object
(
[length] => 0
)
Как исправить мою проблему?