我正在尝试实现BingAds API v11以在python中下载报告。
I am trying to implement the BingAds API v11 to pull down a report in python.
我收到错误:
服务器引发的错误:'格式化程序在尝试反序列化
Server raised fault: 'The formatter threw an exception while trying to deserialize the
消息时抛出异常:尝试反序列化参数时出错
message: There was an error while trying to deserialize parameter
bingads.microsoft/Reporting/v9:ReportRequest。
bingads.microsoft/Reporting/v9:ReportRequest.
InnerException消息是'第1行第1820位错误。元素
The InnerException message was 'Error in line 1 position 1820. Element
'bingads.microsoft/Reporting/v9:ReportRequest'包含来自某种类型的数据映射到名称
'bingads.microsoft/Reporting/v9:ReportRequest' contains data from a type that maps to the name
'bingads.microsoft/Reporting/v11:BudgetSummaryReportRequest'。反序列化器不知道映射到此名称的任何类型的
'bingads.microsoft/Reporting/v11:BudgetSummaryReportRequest'. The deserializer has no knowledge
。如果您正在使用
DataContractSerializer或将与'BudgetSummaryReportRequest'
DataContractSerializer or add the type corresponding to 'BudgetSummaryReportRequest'
对应的类型添加到已知类型列表中,请考虑使用DataContractResolver - 例如,通过使用KnownTypeAttribute属性或添加它传递给传递给序列化程序的已知类型的
to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the
列表。有关详细信息,请参阅InnerException。'
list of known types passed to the serializer.'. Please see InnerException for more details.'
无论我请求的报告类型是什么,都会出现此错误,但我无法弄清楚我的遗漏内容请求。这是SOAP客户端日志:
This error comes through regardless of what type of report I request, but I can't figure out what's missing from my request. Here is the SOAP client log:
推荐答案
您好。
我注意到您在同一请求中混合了v9和v11:
I noticed that you are mixing v9 and v11 in the same request:
DEBUG:suds.client:发送到(reporting.api.bingads.microsoft。 com / Api / Advertiser / Reporting / V9 /ReportingService.svc) 消息: <?xml ve rsion = QUOT; 1.0" encoding =" UTF-8"?> < SOAP-ENV:Envelope xmlns:ns3 =" schemas.xmlsoap/soap/envelope/"的xmlns:TNS = QUOT; HTTPS://bingads.microsoft/Reporting/的 V9 " xmlns:ns0 =" schemas.microsoft/2003/10/Serialization/Arrays"的xmlns:NS1 = QUOT; HTTPS://bingads.microsoft/Reporting/的 V9 "的xmlns:ns2的= QUOT; HTTPS://bingads.microsoft/Reporting/的 V11 "的xmlns:的xsi = QUOT; HTTP://www.w3/2001/XMLSchema-instance" xmlns:SOAP-ENV =" schemas.xmlsoap/soap/envelope/">
DEBUG:suds.client:sending to (reporting.api.bingads.microsoft/Api/Advertiser/Reporting/V9/ReportingService.svc) message: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns3="schemas.xmlsoap/soap/envelope/" xmlns:tns="bingads.microsoft/Reporting/v9" xmlns:ns0="schemas.microsoft/2003/10/Serialization/Arrays" xmlns:ns1="bingads.microsoft/Reporting/v9" xmlns:ns2="bingads.microsoft/Reporting/v11" xmlns:xsi="www.w3/2001/XMLSchema-instance" xmlns:SOAP-ENV="schemas.xmlsoap/soap/envelope/">
您是否更新过使用bingads.v11.reporting ?如果你有最新的SDK,这个样本应该可以使用(取消预算报告):
Have you updated to use bingads.v11.reporting? If you have the latest SDK this sample should work (uncomment for the budget report):
github/BingAds/BingAds-Python-SDK/blob/master/examples/BingAdsPythonConsoleExamples/BingAdsPythonConsoleExamples/v11/report_requests.py #L23
我希望这有帮助!
更多推荐
报告序列化错误
发布评论