问题描述
我正在尝试实现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
https://bingads.microsoft.com/Reporting/v9:ReportRequest。
https://bingads.microsoft.com/Reporting/v9:ReportRequest.
InnerException消息是'第1行第1820位错误。元素
The InnerException message was 'Error in line 1 position 1820. Element
'https://bingads.microsoft.com/Reporting/v9:ReportRequest'包含来自某种类型的数据映射到名称
'https://bingads.microsoft.com/Reporting/v9:ReportRequest' contains data from a type that maps to the name
'https://bingads.microsoft.com/Reporting/v11:BudgetSummaryReportRequest'。反序列化器不知道映射到此名称的任何类型的
'https://bingads.microsoft.com/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:发送到(https://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 =" http://schemas.xmlsoap.org/soap/envelope/"的xmlns:TNS = QUOT; HTTPS://bingads.microsoft.com/Reporting/的 V9 强>"
xmlns:ns0 =" http://schemas.microsoft.com/2003/10/Serialization/Arrays"的xmlns:NS1 = QUOT; HTTPS://bingads.microsoft.com/Reporting/的 V9 强>"的xmlns:ns2的= QUOT; HTTPS://bingads.microsoft.com/Reporting/的 V11 强>"的xmlns:的xsi = QUOT; HTTP://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV =" http://schemas.xmlsoap.org/soap/envelope/">
DEBUG:suds.client:sending to (https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V9/ReportingService.svc)
message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns3="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="https://bingads.microsoft.com/Reporting/v9" xmlns:ns0="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns1="https://bingads.microsoft.com/Reporting/v9" xmlns:ns2="https://bingads.microsoft.com/Reporting/v11" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/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):
我希望这有帮助!
这篇关于报告序列化错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!