private function getSOAPFault(DOMDocument $soapMessage) : ?string
    {
        $soapFault = Utils::xpQuery($soapMessage->firstChild, '/soap-env:Envelope/soap-env:Body/soap-env:Fault');

        if (empty($soapFault)) {
            /* No fault. */

            return null;
        }
        $soapFaultElement = $soapFault[0];
        // There is a fault element but we haven't found out what the fault string is
        $soapFaultString = "Unknown fault string found";
        // find out the fault string
        $faultStringElement = Utils::xpQuery($soapFaultElement, './soap-env:faultstring');
        if (!empty($faultStringElement)) {
            return $faultStringElement[0]->textContent;
        }

        return $soapFaultString;
    }
private function getSOAPFault(DOMDocument $soapMessage) : ?string
    {
        $soapFault = Utils::xpQuery($soapMessage->firstChild, '/soap-env:Envelope/soap-env:Body/soap-env:Fault');

        if (empty($soapFault)) {
            /* No fault. */

            return null;
        }
        $soapFaultElement = $soapFault[0];
        // There is a fault element but we haven't found out what the fault string is
        $soapFaultString = "Unknown fault string found";
        // find out the fault string
        $faultStringElement = Utils::xpQuery($soapFaultElement, './soap-env:faultstring');
        if (!empty($faultStringElement)) {
            return $faultStringElement[0]->textContent;
        }

        return $soapFaultString;
    }
private function getSOAPFault ( DOMDocument $ soapMessage ) : ? string { $ soapFault = Utils :: xpQuery ( $ soapMessage -> firstChild , '/soap-env:Envelope/soap-env:Body/soap-env:Fault' ) ; if ( empty ( $ soapFault ) ) { /* No fault. */ return null ; } $ soapFaultElement = $ soapFault [ 0 ] ; // There is a fault element but we haven't found out what the fault string is $ soapFaultString = "Unknown fault string found" ; // find out the fault string $ faultStringElement = Utils :: xpQuery ( $ soapFaultElement , './soap-env:faultstring' ) ; if ( ! empty ( $ faultStringElement ) ) { return $ faultStringElement [ 0 ] -> textContent ; } return $ soapFaultString ; }
Extracts the SOAP Fault from SOAP message

@param \DOMDocument $soapMessage Soap response needs to be type DOMDocument
@return string|null $soapfaultstring
Extracts the SOAP Fault from SOAP message