0

This my php code for parsing the xml code as given below:

$name = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body>
    <QueryReportResponse xmlns="nPAY">
        <QueryReportResult>&lt;QueryReportResponse xmlns="nPAY" /&gt;
        </QueryReportResult>
    </QueryReportResponse>
</soap:Body>
</soap:Envelope>';

$xml = simplexml_load_string($name);
var_dump($xml);

But i am getting this kind of error as described below:

Warning: simplexml_load_string(): namespace warning : xmlns: URI nPAY is not absolute in C:\xampp\htdocs\test.php on line 56

Warning: simplexml_load_string(): <QueryReportResponse xmlns="nPAY"> in C:\xampp\htdocs\test.php on line 56

Warning: simplexml_load_string(): ^ in C:\xampp\htdocs\test.php on line 56
object(SimpleXMLElement)#1 (0) { }

Am I missing something ?? How to parse this kind of soap response ?

sabin adhikari
  • 225
  • 3
  • 14

1 Answers1

0

Removing soap envelope and soap body tags and adding http:// in URI section of the xmlns does the tricks.

sabin adhikari
  • 225
  • 3
  • 14