Функция ошибки PHP Softlayer API (setObjectFilter) не является допустимым методом для этой службы

Я попытался использовать фильтр объектов, чтобы получить действительное устройство:

Ниже приведен php-код:

$client= SoftLayer_SoapClient::getClient('SoftLayer_Account', null, $username, $apiKey);

    $filter = new stdClass();
    $filter->applicationDeliveryControllers = new stdClass();
    $filter->applicationDeliveryControllers->billingItem = new stdClass();
    $filter->applicationDeliveryControllers->billingItem->id = new stdClass();
    $filter->applicationDeliveryControllers->billingItem->id->operation = new stdClass();
    $filter->applicationDeliveryControllers->billingItem->id->operation = $bId;

    $client->setObjectFilter($filter);  

    try {
          $mask ='mask[id, name]';
            $client->setObjectMask($mask);
        $myInstance = $clientNetscaler->getApplicationDeliveryControllers();

    } catch(exception $ex) {

    } 

Я получил следующую ошибку в моей среде выполнения:

Произошла ошибка при запросе API SoftLayer: функция ("setObjectFilter") не является допустимым методом для этой службы.

Ошибка пришла из строки $client->setObjectFilter($filter);

Кто-нибудь знает, почему такая ошибка?


person mnnmountain    schedule 17.11.2015    source источник


Ответы (1)


У меня фильтр работает нормально. На всякий случай скопировал свой код. Убедитесь, что у вас установлен PHP 5.2.3 или выше и расширение PHP для SOAP. Также попробуйте повторно загрузить PHP-клиент Softlayer https://github.com/softlayer/softlayer-api-php-client и повторите попытку.

С Уважением

<?php
 require_once ('/SoapClient.class.php');
 $apiUsername = 'set me';
$apiKey = 'set me';

$accountService = Softlayer_SoapClient::getClient('SoftLayer_Account', null,$apiUsername, $apiKey);
$bId = 51774239;
$filter = new stdClass();
$filter->applicationDeliveryControllers = new stdClass();
$filter->applicationDeliveryControllers->billingItem = new stdClass();
$filter->applicationDeliveryControllers->billingItem->id = new stdClass();
$filter->applicationDeliveryControllers->billingItem->id->operation = new     stdClass();
$filter->applicationDeliveryControllers->billingItem->id->operation = $bId;
$accountService->setObjectFilter($filter);  
$mask ='mask[id, name]';
$accountService->setObjectMask($mask);
try {
    $myInstance  = $accountService->getApplicationDeliveryControllers();
    print_r($myInstance);
} catch (Exception $e) {
    die('Unable to executre the request. ' . $e->getMessage());
}
person Nelson Raul Cabero Mendoza    schedule 17.11.2015