且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Bing购物添加产品范围

更新时间:2023-10-25 14:01:40

您好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.

我希望这有帮助!