【发布时间】:2021-07-11 03:48:52
【问题描述】:
例如,我试图从这个 SOAP 调用中提取 ServiceType。在下面的示例中,它显示 FTTN
if (VocusDevController::login()) {
$client = new SoapClient('wsdl/VocusSchemas/WholesaleServiceManagement.wsdl', array(
'trace' => 1,
'exception' => true
));
try {
$response = $client->Get(array(
"AccessKey" => "SOMEKEY",
"ProductID" => "FIBRE",
"Scope" => "QUALIFY",
"Parameters" => array('Param' => array('_' => 'LOC000023125730', 'id' => 'DirectoryID'))
));
echo '<pre>';
print_r($response);
echo '</pre>';
echo '<hr>';
// $output = $response->Parameters->Param->ServiceType; // This is where I am trying to extract ServiceType
} catch (Exception $exception) {
echo 'Exception Thrown: ' . $exception->getMessage();
}
}
这是我从上述调用中得到的输出
stdClass Object
(
[TransactionID] => 17A935CDC7E1906
[ResponseType] => SYNC
[Parameters] => stdClass Object
(
[Param] => Array
(
[0] => stdClass Object
(
[_] => PASS
[id] => Result
)
[1] => stdClass Object
(
[_] => FTTN
[id] => ServiceType
)
[2] => stdClass Object
(
[_] => 13
[id] => ServiceClass
)
[3] => stdClass Object
(
[_] => Type 1
[id] => ConnectionType
)
[4] => stdClass Object
(
[_] => 20210910
[id] => CopperDisconnectionDate
)
[5] => stdClass Object
(
[_] => Urban
[id] => Zone
)
[6] => stdClass Object
(
[_] => FALSE
[id] => DevelopmentCharge
)
[7] => stdClass Object
(
[_] => CSA200000000332
[id] => CSA
)
[8] => stdClass Object
(
[_] => Auto-Assigned
[id] => CVCID
)
[9] => stdClass Object
(
[_] => CPI300009724591N/ALine In Use13N/AFALSE5Mbps,10Mbps,20Mbps33-3577-82TRUEFALSE
[id] => CopperPairRecord
)
[10] => stdClass Object
(
[_] => LOC000023125730NBNLOT: 18 1 CHILDS CCT BELROSE NSW
[id] => BroadbandAddressRecord
)
)
)
)
我正在尝试使用 $output = $response->Parameters->Param->ServiceType; 提取 ServiceType,但是,我只是收到此错误:-
ErrorException
Attempt to read property "ServiceType" on array
所以,我显然试图错误地提取它。有人可以阐明我做错了什么吗?谢谢
【问题讨论】:
标签: php soap soap-client