[SoapFault]无法创建抽象类(尝试更新分区出价金额)(PHP) [英] [SoapFault] Cannot create an abstract class (Trying to update partition bid amounts) (PHP)

查看:54
本文介绍了[SoapFault]无法创建抽象类(尝试更新分区出价金额)(PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有!

我一直在尝试修改AdGroupCriterion出价金额,无论我做什么或如何尝试,我都会从标题中得到错误。

I've been attempting to edit AdGroupCriterion bid amounts and no matter what I do or how I try it, I get the error from the title.

我尝试了两种不同的API调用:

I've tried with 2 different API calls:

ApplyProductPartitionActions和UpdateAdGroupCriterions。

ApplyProductPartitionActions and UpdateAdGroupCriterions.

对于UpdateAdGroupCriterions(仅用于概念验证)我从API中提取AdGroupCriterion,更改值,然后重新发送到API以更新它。以下是我现在的做法:

For UpdateAdGroupCriterions (just for proof of concept) I am pulling an AdGroupCriterion from the API, changing a value, then resending to the API to update it. Here's how I'm doing it now:

$req = new GetAdGroupCriterionsByIdsRequest();
$req->AccountId = XXXXX
$req->AdGroupCriterionIds = [XXXXX];
$req->AdGroupId = XXXXX;
$req->CriterionType = CriterionType::ProductPartition;
$res = $apiService->GetAdGroupCriterionsByIds($req);

$criterion = $res->AdGroupCriterions->AdGroupCriterion[0];
$criterion->CriterionBid->Bid->Amount = .20;

$req = new UpdateAdGroupCriterionsRequest();
$req->AccountId = XXXXXX;
$criterion = new \SoapVar($criterion, SOAP_ENC_OBJECT, 'AdGroupCriterion', 'https://bingads.microsoft.com/CampaignManagement/v9');
$req->AdGroupCriterions = [$criterion];
$apiService->UpdateAdGroupCriterions($req);

我已尝试使用和不使用新的\SoapVar行。我也尝试将Bing中的响应对象映射到我的Soap头中的Bing SDK类。映射有效,但最终调用仍然失败并出现上述错误。

I have tried it with and without the new \SoapVar line. I've also tried mapping the response object from Bing to Bing SDK's classes in my Soap headers. The mapping worked, but ultimately the call still failed with the above error.

对此有何帮助?

推荐答案

注意:我也尝试将对象映射到BiddableAdGroupCriterion,它也不起作用。

NOTE: I've also tried mapping the object to a BiddableAdGroupCriterion which didn't work either.

示例SOAP请求/响应:

Example SOAP request/response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://bingads.microsoft.com/CampaignManagement/v9">
   <SOAP-ENV:Header>
      <ns1:CustomerAccountId>XXXX</ns1:CustomerAccountId>
      <ns1:CustomerId>XXXX</ns1:CustomerId>
      <ns1:DeveloperToken>XXXX</ns1:DeveloperToken>
      <ns1:UserName>XXXX</ns1:UserName>
      <ns1:Password>XXXX</ns1:Password>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
      <ns1:ApplyProductPartitionActionsRequest>
         <ns1:CriterionActions>
            <ns1:AdGroupCriterionAction>
               <ns1:Action>Update</ns1:Action>
               <ns1:AdGroupCriterion>
                  <ns1:Criterion>
                     <ns1:Type>ProductPartition</ns1:Type>
                  </ns1:Criterion>
                  <ns1:Id>XXXX</ns1:Id>
                  <ns1:Status>Active</ns1:Status>
                  <ns1:Type>BiddableAdGroupCriterion</ns1:Type>
               </ns1:AdGroupCriterion>
            </ns1:AdGroupCriterionAction>
            <ns1:AdGroupCriterionAction>
               <ns1:Action>Update</ns1:Action>
               <ns1:AdGroupCriterion>
                  <ns1:Criterion>
                     <ns1:Type>ProductPartition</ns1:Type>
                  </ns1:Criterion>
                  <ns1:Id>XXXX</ns1:Id>
                  <ns1:Status>Active</ns1:Status>
                  <ns1:Type>BiddableAdGroupCriterion</ns1:Type>
               </ns1:AdGroupCriterion>
            </ns1:AdGroupCriterionAction>
         </ns1:CriterionActions>
      </ns1:ApplyProductPartitionActionsRequest>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>





<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>
         <faultstring xml:lang="en-US">Cannot create an abstract class.</faultstring>
         <detail>
            <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
               <HelpLink i:nil="true" />
               <InnerException i:nil="true" />
               <Message>Cannot create an abstract class.</Message>
               <StackTrace>at System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type)&#xD;
   at ReadAdGroupCriterionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )&#xD;
   at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract&amp; dataContract)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)&#xD;
   at ReadAdGroupCriterionActionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )&#xD;
   at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract&amp; dataContract)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)&#xD;
   at ReadArrayOfAdGroupCriterionActionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )&#xD;
   at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract&amp; dataContract)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)&#xD;
   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)&#xD;
   at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)&#xD;
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader, XmlObjectSerializer serializer)&#xD;
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
               <Type>System.MemberAccessException</Type>
            </ExceptionDetail>
         </detail>
      </s:Fault>
   </s:Body>
</s:Envelope>





这篇关于[SoapFault]无法创建抽象类(尝试更新分区出价金额)(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆