SimpleXML加载字符串返回空对象

时间:2016-11-18 10:28:29

标签: php xml soap

我在这个混乱中遇到了一个难题,我正在尝试将XML返回从SoapCall转换为对象OR数组,以便轻松地使用这些位置来发送电子邮件。

XML Return:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://br.com.getnet.ecommerce.ws.service/">
<SOAP-ENV:Body>
<ns1:authorizationService>
    <arg0>
        <authentication>
            <username>***</username>
            <password>****</password>
            <merchantID>***</merchantID>
        </authentication>
        <authorizations>
            <authorization>
                <terminalID>D088052002</terminalID>
                <merchantTrackID>534130433</merchantTrackID>
                <amount>186.68</amount>
                <currencycode>986</currencycode>
                <instType>SGL</instType>
                <instNum></instNum>
                    <card>
                        <number>1232121521</number>
                        <cvv2>123</cvv2>
                        <expiryMonth>12</expiryMonth>
                        <expiryYear>2020</expiryYear>
                        <holderName>teste</holderName>
                    </card>
                <userDefinedField>
                    <udf1>000000004935</udf1>
                    <udf2>8226939</udf2>
                    <udf3>08-11-2016</udf3>
                    <udf4>****</udf4>
                    <udf5>****</udf5>
                </userDefinedField>
                <tranMCC></tranMCC>
                <softDescriptor>****</softDescriptor>
            </authorization>
        </authorizations>
    </arg0>
</ns1:authorizationService></SOAP-ENV:Body></SOAP-ENV:Envelope>

我尝试了xml_load_string$xml_data = new SimpleXMLElement($string);,但它总是返回一个空对象,根本没有位置......

有人能帮助我吗? = d

0 个答案:

没有答案