как получить значения, используя php variable / array (nusoap)

Сценарий: я использую nusoap.php и подключаюсь к веб-сервису microsoft. Он возвращает результат в массиве. И это работает.

Проблема. Как получить значение DeviceId, которое возвращается из nusoap, который является массивом? (Потому что мне нужно зацикливать этот массив по строкам и получить значение DeviceId.).

Вот мой код: (Я печатаю все значение массива и xml)

<?php require_once('nusoap.php'); $client = new nusoap_client('http://xxx.xxx.xx.xxx:8060/iapps/Service1.asmx?WSDL', true); $param = array('sql' =>'exec DeviceGet 1 ','p2' => ''); $result = $client->call('GetData',$param , 'Service'); echo print_r($result,true); echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; ?> 

Вот результат:

 Array ( [GetDataResult] => Array ( [schema] => Array ( [element] => Array ( [complexType] => Array ( [choice] => Array ( [element] => Array ( [complexType] => Array ( [sequence] => Array ( [element] => Array ( [!name] => DeviceId [!minOccurs] => 0 ) ) ) [!name] => Table1 ) [!minOccurs] => 0 [!maxOccurs] => unbounded ) ) [!name] => NewDataSet [!msdata:IsDataSet] => true [!msdata:UseCurrentLocale] => true ) [!id] => NewDataSet ) [diffgram] => Array ( [NewDataSet] => Array ( [Table1] => Array ( [0] => Array ( [DeviceId] => 00000000-0000-1000-8000-000C29BB0EEA [!diffgr:id] => Table11 [!msdata:rowOrder] => 0 ) [1] => Array ( [DeviceId] => 2f73ba3b80df3636c14e1bafa3818f06d42ebe4d [!diffgr:id] => Table12 [!msdata:rowOrder] => 1 ) [2] => Array ( [DeviceId] => 448252633b4dde13c4cf0431d4055d69ffc70723 [!diffgr:id] => Table13 [!msdata:rowOrder] => 2 ) [3] => Array ( [DeviceId] => 731a2f59b54d38df202315cd3853e3272757febd [!diffgr:id] => Table14 [!msdata:rowOrder] => 3 ) [4] => Array ( [DeviceId] => f855ded29053b276cd99452a454477e5a2d27787 [!diffgr:id] => Table15 [!msdata:rowOrder] => 4 ) ) ) ) ) ) Response HTTP/1.1 200 OK Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET Date: Thu, 07 Apr 2011 21:18:12 GMT Connection: close Content-Length: 1598 <?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><GetDataResponse xmlns="http://tempuri.org/"><GetDataResult><xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"><xs:complexType><xs:choice minOccurs="0" maxOccurs="unbounded"><xs:element name="Table1"><xs:complexType><xs:sequence><xs:element name="DeviceId" type="xs:string" minOccurs="0" /></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><NewDataSet xmlns=""><Table1 diffgr:id="Table11" msdata:rowOrder="0"><DeviceId>00000000-0000-1000-8000-000C29BB0EEA</DeviceId></Table1><Table1 diffgr:id="Table12" msdata:rowOrder="1"><DeviceId>2f73ba3b80df3636c14e1bafa3818f06d42ebe4d</DeviceId></Table1><Table1 diffgr:id="Table13" msdata:rowOrder="2"><DeviceId>448252633b4dde13c4cf0431d4055d69ffc70723</DeviceId></Table1><Table1 diffgr:id="Table14" msdata:rowOrder="3"><DeviceId>731a2f59b54d38df202315cd3853e3272757febd</DeviceId></Table1><Table1 diffgr:id="Table15" msdata:rowOrder="4"><DeviceId>f855ded29053b276cd99452a454477e5a2d27787</DeviceId></Table1></NewDataSet></diffgr:diffgram></GetDataResult></GetDataResponse></soap:Body></soap:Envelope> 

 foreach ($result['GetDataResult']['diffgram']['NewDataSet']['Table1'] as $item) { echo $item['DeviceId'] . PHP_EOL; } 

Вывод:

 00000000-0000-1000-8000-000C29BB0EEA 2f73ba3b80df3636c14e1bafa3818f06d42ebe4d 448252633b4dde13c4cf0431d4055d69ffc70723 731a2f59b54d38df202315cd3853e3272757febd f855ded29053b276cd99452a454477e5a2d27787