AddCampaignCriterions v11因抽象类失败 [英] AddCampaignCriterions v11 Fails for Abstract Class
问题描述
我们正在将我们的平台从v10迁移到v11,当我尝试将广告系列标准添加到广告时,我会在测试中遇到问题。我们刚刚制作的活动。 FWIW,我们正在使用通过composer安装的最新版本的PHP SDK。
We're migrating our platform over to v11 from v10 and I keep running up against a problem in our tests when I try to add campaign criterions to a campaign we just made. FWIW, we are using the latest version of the PHP SDK installed via composer.
我收到以下异常:
I get the following exception:
stdClass对象
(
[ExceptionDetail] => stdClass对象
  ; (
$
[HelpLink] =>
[InnerException] =>
[Message] =>无法创建抽象类。
[StackTrace] => at System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type)
在ReadCampaignCriterionFromXml(XmlReaderDelegator,XmlObjectSerializerReadContext,XmlDictionaryString [],XmlDictionaryString [])
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader,Xml ObjectSerializerReadContext context)
 在System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator读卡器,字符串名称,串NS,类型的declaredType,DataContract和放大器; dataContract)
  at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader,Int32 id,RuntimeTypeHandle declaredTypeHandle,String name,String ns)
 在ReadArrayOfCampaignCriterionFromXml(XmlReaderDelegator,XmlObjectSerializerReadContext,XmlDictionaryString,XmlDictionaryString,CollectionDataContract)
  at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader,XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader,String name,String ns,Type declaredType,DataContract& dataContract)
 在System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator的XmlReader,类型的declaredType,DataContract dataContract,字符串名称,串NS)
   在System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator的XmlReader,布尔verifyObjectName,DataContractResolver dataContractResolver)
  at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader,Boolean verifyObjectName,DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader,Boolean verifyObjectName)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader,XmlObjectSerializer serializer)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader,PartInfo part,Boolean isRequest)
 在System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader读卡器,PartInfo []份,对象[]参数,布尔isRequest)
  at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader,MessageVersion version,String action,MessageDescription messageDescription,Object [] parameters,Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message,Object [] parameters,Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message,Object [] parameters)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
          [类型] => System.MemberAccessException
      )b
$
)
stdClass Object
(
[ExceptionDetail] => stdClass Object
(
[HelpLink] =>
[InnerException] =>
[Message] => Cannot create an abstract class.
[StackTrace] => at System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type)
at ReadCampaignCriterionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadArrayOfCampaignCriterionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader, XmlObjectSerializer serializer)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
[Type] => System.MemberAccessException
)
)
令人沮丧的是我似乎无法忍受弄清楚它在抱怨哪一堂课。我在请求中看到的每个类都不是抽象的,至少根据参考文档。以下是生成上述异常的请求:
The frustrating part is I can't seem to figure out which class it's complaining about. Every class I see in the request is not abstract, at least according to the reference docs. Here's what the request looks like that generates the above exception:
我觉得我在这里错过了一些愚蠢的东西。任何帮助将不胜感激。
I feel like I'm missing something silly here. Any help would be greatly appreciated.
谢谢,
迈克
推荐答案
好的,所以我在这里回复自己,但是这个场景真的缺乏文档。基本上,问题是我传递了一系列实际对象,如 Microsoft \BingAds\V11 \CampaignManagement \ BiddableCampaignCriterion
相反,您需要将所有内容更改为:
新的SoapVar(
Ok so I'm replying to myself here, but the docs are really lacking for this scenario. Basically, the problem is I was passing an array of actual objects like Microsoft\BingAds\V11\CampaignManagement\BiddableCampaignCriterion
Instead you need to change everything to:
new SoapVar(
Object,SOAP_ENC_OBJECT,'BiddableCampaignCriterion',PROXY NAMESPACE);
CampaignCriterions需要使用每个BiddableCampaignCriterion对象上的CriterionBid和Criterion属性进行编码。
Gosh我非常讨厌SOAP。这些令人费解的错误让我陷入困境。
Object, SOAP_ENC_OBJECT, 'BiddableCampaignCriterion', PROXY NAMESPACE);
The CampaignCriterions need to be encoded this way ALONG with the CriterionBid and Criterion properties on each BiddableCampaignCriterion object.
Gosh I hate SOAP so much. It's convoluted errors like these that drive me up the wall.
这是我的新请求在SOAP化之后的样子:
这篇关于AddCampaignCriterions v11因抽象类失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!