Bing购物添加产品范围 [英] Bing shopping adding product scope

查看:71
本文介绍了Bing购物添加产品范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

使用API​​ AddCampaignCriterionsRequest时,我收到API反序列化错误。你能否告诉我API请求有什么问题?

I am getting an API deserialization error, when using the API AddCampaignCriterionsRequest. Can you please tell me what is wrong with the API request?

错误我收到的是 

The error I received was 

 尝试反序列化参数https://bingads.microsoft.com/CampaignManagement/v9:CampaignCriterions时出错。 InnerException消息是'第27行第21行的错误。'EndElement''CampaignCriterion'来自名称空间'https://bingads.microsoft.com/CampaignManagement/v9'
不是预期的。期待元素'ForwardCompatibilityMap | Id'。'

 There was an error while trying to deserialize parameter https://bingads.microsoft.com/CampaignManagement/v9:CampaignCriterions. The InnerException message was 'Error in line 27 position 21. 'EndElement' 'CampaignCriterion' from namespace 'https://bingads.microsoft.com/CampaignManagement/v9' is not expected. Expecting element 'ForwardCompatibilityMap | Id'.'

谢谢

Vignesh

推荐答案

您好Vignesh。

Hi Vignesh.

我可以重新报告您报告的问题 如果我手动删除Id元素。这是一个有效的SOAP请求,它运行

Python代码示例中的购物广告系列

I am able to repro the issue you reported if I manually remove the Id element. Here is a working SOAP request by running the Shopping Campaigns in Python code example.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://bingads.microsoft.com/CampaignManagement/v9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://bingads.microsoft.com/CampaignManagement/v9" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header>
      <tns:CustomerAccountId>*</tns:CustomerAccountId>
      <tns:CustomerId>*</tns:CustomerId>
      <tns:DeveloperToken>*</tns:DeveloperToken>
      <tns:Password>*</tns:Password>
      <tns:UserName>*</tns:UserName>
   </SOAP-ENV:Header>
   <ns0:Body>
      <ns1:AddCampaignCriterionsRequest>
         <ns1:CampaignCriterions>
            <ns1:CampaignCriterion>
               <ns1:CampaignId>*</ns1:CampaignId>
               <ns1:Criterion xsi:type="ns1:ProductScope">
                  <ns1:Conditions>
                     <ns1:ProductCondition>
                        <ns1:Attribute>New</ns1:Attribute>
                        <ns1:Operand>Condition</ns1:Operand>
                     </ns1:ProductCondition>
                     <ns1:ProductCondition>
                        <ns1:Attribute>MerchantDefinedCustomLabel</ns1:Attribute>
                        <ns1:Operand>CustomLabel0</ns1:Operand>
                     </ns1:ProductCondition>
                  </ns1:Conditions>
               </ns1:Criterion>
               <ns1:Id xsi:nil="true"/>
            </ns1:CampaignCriterion>
         </ns1:CampaignCriterions>
         <ns1:CriterionType>ProductScope</ns1:CriterionType>
      </ns1:AddCampaignCriterionsRequest>
   </ns0:Body>
</SOAP-ENV:Envelope>

如果我捕获上述SOAP请求然后手动删除元素并再次运行,例如在
SoapUI 中,我可以重新报告您报告的错误:

If I capture the above SOAP request and then manually remove this element and run again e.g. in SoapUI, I can repro the error you reported:

<ns1:Id xsi:nil="true"/>

我认为需要的原因是
Campaign Management WSDL
未定义minOccurs =" 0"对于CampaignCriterion。

I believe the reason it is required is that the Campaign Management WSDL does not define minOccurs="0" for CampaignCriterion.

<xs:element name="Id" type="xs:long" nillable="true"/>

根据
W3C建议
,如果未指定minOccurs,则默认值为"1"。因此要求出现该元素。

According to the W3C Recommendation, if minOccurs is not specified the default is "1" and thus the element is required to appear.

广告系列管理服务中的大多数ID元素都包含minOccurs =" 0" 我将跟进我们的工程团队,了解我们需要它的原因对于CampaignCriterion。在此期间,您应该将其包含在您的请求中。
你是如何生成SOAP的?我正在使用Python SDK,生成的SOAP确实包含了Id元素。再次如上所述 我正在使用

此代码示例
。如果您使用的是字典而不是factory.create,那么我建议您尝试设置Id = None。

Most Id elements in the Campaign Management service have minOccurs="0", and I will follow up with our engineering team to understand more about why we require it for CampaignCriterion. In the meantime you should include it in your request. How are you generating the SOAP? I'm using the Python SDK, and the generated SOAP does include the Id element. Again as mentioned above I'm using this code example. If you are using a dictionary instead of factory.create then I suggest you try setting Id=None.

我希望这有帮助!


这篇关于Bing购物添加产品范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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