从php soapClient响应中获取值

时间:2016-03-06 15:21:45

标签: php soap-client

我通过代码获取数据是成功的:

$client = new SoapClient($wsdl,$options);
$response = $client->someMethod($params);

然而,我正在努力尝试从响应中获取单个数据。 如果var_dump它,我得到:

object(stdClass)#2 (1) 
{
["getPr"]=> object(stdClass)#3 (2) 
{ 
    ["responseStatus"]=> object(stdClass)#4 (4) 
    { 
     ["retCode"]=> string(3) "000" ["retDesc"]=> string(32) "aaa" ["message"]=> string(32) "aaaa" ["numElem"]=> int(38) 
    }

 ["pr"]=> object(stdClass)#5 (3) { ["anagraficaUtente"]=> object(stdClass)#6 (0) { }
 ["decPr"]=> object(stdClass)#7 (0) { }
 ["userinfo"]=> object(stdClass)#8 (2) 
 {
    ["up"]=> object(stdClass)#9 (6) 
    { 
        ["abs"]=> object(stdClass)#10 (1) 
        {
         ["ab"]=> array(25) 
            { 
                [0]=> object(stdClass)#11 (1) { ["codice"]=> string(6)  "aaaa" }
                [1]=> object(stdClass)#12 (1) { ["codice"]=> string(6)  "aaaa" }
                [2]=> object(stdClass)#13 (1) { ["codice"]=> string(6)  "aaaa" }
            }
        }
    ["profili"]=> object(stdClass)#36 (1) 
        {
            ["profilo"]=> array(2)
            { 
                [0]=> object(stdClass)#37 (1) { ["codice"]=> string(6) "aaaa" } 
                [1]=> object(stdClass)#38 (1) { ["codice"]=> string(6) "000000" } 
            } 
        }
    ["abPr"]=> object(stdClass)#39 (2) 
    {
        ["ab"]=> array(11) 
        {
            [0]=> object(stdClass)#40 (1) { ["codice"]=> string(6) "aaaa" }
            [1]=> object(stdClass)#41 (1) { ["codice"]=> string(6) "aaaa" }  
        } 
        ["name"]=> string(6) "aaaa" 
    }
    ["company"]=> string(2) "01" ["u"]=> string(5) "1234" ["company"]=> string(2) "12" } ["user"]=> string(7) "mark" 
} 
}
}
}

我试图将元素放入" ab"以下内容:

foreach($response->getPr->userinfo->up->abs->ab as $data) 
    echo $data->codice;

但它根本不起作用

有什么建议吗?

0 个答案:

没有答案