我有一个 PHP 代码,我曾经调用 verifyOrder 来进行 Endurance Block 存储,它可以正常工作。我原以为只需更改价格 ID,它也适用于性能块存储。但这似乎没有那么简单。我从 SoftLayer 看到它使用以下价格 ID:40678、40688、40798 所以我将上面的价格 ID 列表以及包裹 ID 替换为 222。但我最终得到了这样的错误:
PHP Fatal error: Uncaught exception 'Exception' with message 'There was an error querying the SoftLayer API: Invalid pr
ice Block Storage (Performance) (40678) provided on the order container.'
我不知道为什么。SoftLayer 中是否有任何用于验证性能块存储顺序的良好工作示例?
下面是我为 Endurance 存储所拥有的基本代码流。
$priceIds = array (
45064,
45104,
45074,
45124,
46156
);
$orderPrices = array();
foreach ($priceIds as $priceId){
$price = new stdClass();
$price->id = $priceId;
$orderPrices[] = $price;
}
$osFormatType = new stdClass();
$osFormatType->id = 12;
$osFormatType->keyName = 'LINUX';
$orderTemplate = new stdClass();
$orderTemplate->location = $location;
$orderTemplate->packageId = $packageId;
$orderTemplate->osFormatType = $osFormatType;
$orderTemplate->complexType = 'SoftLayer_Container_Product_Order_Network_Storage_Enterprise';
$orderTemplate->prices = $orderPrices;
$orderTemplate->quantity = 1;
$productOrderClient = SoftLayer_SoapClient::getClient
(
'SoftLayer_Product_Order',
null,
$apiUsername,
$apiKey
);
$my_template = new SoapVar($orderTemplate, SOAP_ENC_OBJECT, 'SoftLayer_Container_Product_Order_Network_Storage_Enterprise', 'http://api.service.softlayer.com/soap/v3/');
$result = $productOrderClient->verifyOrder($my_template);