我已经尝试过下面的代码进行更新,但它没有用,它显示错误代码:
致命错误:未捕获的SoapFault异常:[a:InternalServiceFault]无法创建抽象类。在D:\ xampp \ htdocs \ bingTest \ UpdateAccount.php:81堆栈跟踪:#0 D:\ xampp \ htdocs \ bingTest \ UpdateAccount.php(81):SoapClient-> __ call(' UpdateAccount' ,数组)#1 D:\ xampp \ htdocs \ bingTest \ UpdateAccount.php(81):SoapClient-> UpdateAccount(对象(BingAds \ CustomerManagement \ UpdateAccountRequest))#2 D:\ xampp \ htdocs \ bingTest \ UpdateAccount.php (62):在第81行的D:\ xampp \ htdocs \ bingTest \ UpdateAccount.php中抛出的UpdateAccount(对象(BingAds \ Proxy \ ClientProxy),对象(BingAds \ CustomerManagement \ AdvertiserAccount))#3 {main}
$wsdl = "https://clientcenter.api.sandbox.bingads.microsoft.com/Api/CustomerManagement/v9/CustomerManagementService.svc?singleWsdl";
$proxy = ClientProxy::ConstructWithAccountAndCustomerId($wsdl, $UserName, $Password, $DeveloperToken, $AccountId, null, null);
$last_modified_time=GetAccount($proxy,$AccountId);
$account_obj=new AdvertiserAccount();
$account_obj->AccountType='Advertisement';
$account_obj->CountryCode="US";
$account_obj->CurrencyType="USD";
$account_obj->Id=$AccountId;
$account_obj->LastModifiedTime=$last_modified_time;
$account_obj->Name="Test Account";
$account_obj->AccountLifeCycleStatus='Pause';
UpdateAccount($proxy, $account_obj);
function GetAccount($proxy,$AccountId)
{
$account_obj=new GetAccountRequest();
$account_obj->AccountId=$AccountId;
return $proxy->GetService()->GetAccount($account_obj)->Account->LastModifiedTime;
}
function UpdateAccount($proxy, $update_account_info)
{
$request = new UpdateAccountRequest();
$request->Account = $update_account_info;
return $proxy->GetService()->UpdateAccount($request);
}
答案 0 :(得分:0)
如果您仍需要解决方案。你需要这样做:
$encodedAccount = new \SoapVar(
$account,
SOAP_ENC_OBJECT,
'AdvertiserAccount',
'https://bingads.microsoft.com/Customer/v9/Entities'
);
$request->Account = $encodedAccount;