本文介绍了附加链接添加自定义参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Team,

我正在尝试使用AddAdExtension API方法将自定义参数添加到附加链接。我在尝试这样做时收到以下错误

I am trying to add custom parameter to sitelink using the AddAdExtension API method. I am receiving the following error while trying to do this

< s:Envelope xmlns:s =" http://schemas.xmlsoap.org/soap/envelope/"> ;< s:Body>< s:Fault>< faultcode xmlns:a =" http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher"> a:DeserializationFailed< / faultcode> ;< faultstring
xml:lang =" en-US">格式化程序在尝试反序列化消息时引发异常:尝试反序列化参数时发生错误https://bingads.microsoft.com / CampaignManagement / V10:的AdExtension。 InnerException消息是
'第31行位置23的错误。不期望命名空间'https://bingads.microsoft.com/CampaignManagement/v10'中的'EndElement''UrlCustomParameters'。期待元素'参数'。'。  有关详细信息,请参阅InnerException。< / faultstring>< detail>< ExceptionDetail
xmlns =" http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i =" http://www.w3.org/2001/XMLSchema-instance">< HelpLink i:nil =" true" />< InnerException>< HelpLink i:nil =" ; true" />< InnerException
i:nil =" true" />< Message>第31行第23位错误。'EndElement''UrlCustomParameters'来自命名空间'https://bingads.microsoft .com / CampaignManagement / v10'不是预期的。期待元素'参数'。< / Message>< StackTrace>
 在System.Runtime.Serialization.XmlObjectSerializerReadContext.ThrowRequiredMemberMissingException(XmlReaderDelegator xmlReader,Int32 memberIndex,Int32 requiredIndex,XmlDictionaryString [] memberNames)& #xD;

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode><faultstring xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/CampaignManagement/v10:AdExtensions. The InnerException message was 'Error in line 31 position 23. 'EndElement' 'UrlCustomParameters' from namespace 'https://bingads.microsoft.com/CampaignManagement/v10' is not expected. Expecting element 'Parameters'.'.  Please see InnerException for more details.</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Error in line 31 position 23. 'EndElement' 'UrlCustomParameters' from namespace 'https://bingads.microsoft.com/CampaignManagement/v10' is not expected. Expecting element 'Parameters'.</Message><StackTrace>   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ThrowRequiredMemberMissingException(XmlReaderDelegator xmlReader, Int32 memberIndex, Int32 requiredIndex, XmlDictionaryString[] memberNames)&#xD;

以下是SOAP请求

< SOAP-ENV:正文>

< AddAdExtensionsRequest xmlns = QUOT; HTTPS://bingads.microsoft.com/CampaignManagement/v10" SOAP-ENC:root =" 1">

< AccountId> ****< / AccountId>

< AdExtensions xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance">

< AdExtension xsi:type =" SiteLinksAdExtension">

< Type> ; SiteLinksAdExtension< / Type>

< SiteLinks xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance">

< ; SiteLink>

< DisplayText> csl hello< / DisplayText>

< FinalUrls>

< string xmlns =" http: //schemas.microsoft.com/2003/10/Serialization/Arrays">https://www.adobe.com</string>

< / FinalUrls>

< TrackingUrlTemplate> http://www.abe.com/?url = {lpurl}< / TrackingUrlTemplate>

< UrlCustomParameters xsi:nil =" false">

<参数xsi:nil =" false">

< CustomParameter>

< Key> __ name __< / Key>

< Value> hello< ; /值>

< / CustomParameter>

< /参数>

< / UrlCustomParameters>

< / SiteLink>

< / SiteLinks>

< / AdExtension>

< / AdExtensions>

< / AddAdExtensionsRequest>
$
< / SOAP-ENV:正文>

<SOAP-ENV:Body>
<AddAdExtensionsRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v10" SOAP-ENC:root="1">
<AccountId>****</AccountId>
<AdExtensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AdExtension xsi:type="SiteLinksAdExtension">
<Type>SiteLinksAdExtension</Type>
<SiteLinks xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SiteLink>
<DisplayText>csl hello</DisplayText>
<FinalUrls>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">https://www.adobe.com</string>
</FinalUrls>
<TrackingUrlTemplate>http://www.abe.com/?url={lpurl}</TrackingUrlTemplate>
<UrlCustomParameters xsi:nil="false">
<Parameters xsi:nil="false">
<CustomParameter>
<Key>__name__</Key>
<Value>hello</Value>
</CustomParameter>
</Parameters>
</UrlCustomParameters>
</SiteLink>
</SiteLinks>
</AdExtension>
</AdExtensions>
</AddAdExtensionsRequest>
</SOAP-ENV:Body>

你能帮帮我吗理解这个?如果可能,请发布一个有效的SOAP请求。

Can you please help me in understanding this? If possible can you please post a working SOAP request.

谢谢

Vignesh

推荐答案

这是一个有效的例子:

Here's a working example:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ApplicationToken i:nil="true" xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" />
    <h:AuthenticationToken xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10">***</h:AuthenticationToken>
    <h:CustomerAccountId xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10">***</h:CustomerAccountId>
    <h:CustomerId xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10">***</h:CustomerId>
    <h:DeveloperToken xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10">***</h:DeveloperToken>
    <h:Password i:nil="true" xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" />
    <h:UserName i:nil="true" xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" />
  </s:Header>
  <s:Body>
    <AddAdExtensionsRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
      <AccountId>***</AccountId>
      <AdExtensions xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <AdExtension i:type="CallAdExtension">
          <ForwardCompatibilityMap i:nil="true" xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
          <Id i:nil="true" />
          <Status i:nil="true" />
          <Type i:nil="true" />
          <Version i:nil="true" />
          <CountryCode>US</CountryCode>
          <DevicePreference i:nil="true" />
          <IsCallOnly>false</IsCallOnly>
          <IsCallTrackingEnabled i:nil="true" />
          <PhoneNumber>2065550100</PhoneNumber>
          <RequireTollFreeTrackingNumber i:nil="true" />
        </AdExtension>
        <AdExtension i:type="LocationAdExtension">
          <ForwardCompatibilityMap i:nil="true" xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
          <Id i:nil="true" />
          <Status i:nil="true" />
          <Type i:nil="true" />
          <Version i:nil="true" />
          <Address>
            <CityName>Woodinville</CityName>
            <CountryCode>US</CountryCode>
            <PostalCode>98608</PostalCode>
            <ProvinceCode i:nil="true" />
            <ProvinceName>WA</ProvinceName>
            <StreetAddress>1234 Washington Place</StreetAddress>
            <StreetAddress2>Suite 1210</StreetAddress2>
          </Address>
          <CompanyName>Contoso Shoes</CompanyName>
          <GeoCodeStatus i:nil="true" />
          <GeoPoint i:nil="true" />
          <IconMediaId i:nil="true" />
          <ImageMediaId i:nil="true" />
          <PhoneNumber>206-555-0100</PhoneNumber>
        </AdExtension>
        <AdExtension i:type="SiteLinksAdExtension">
          <ForwardCompatibilityMap i:nil="true" xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
          <Id i:nil="true" />
          <Status i:nil="true" />
          <Type i:nil="true" />
          <Version i:nil="true" />
          <SiteLinks>
            <SiteLink>
              <Description1 i:nil="true" />
              <Description2 i:nil="true" />
              <DestinationUrl i:nil="true" />
              <DevicePreference i:nil="true" />
              <DisplayText>Women's Shoe Sale 1</DisplayText>
              <FinalAppUrls i:nil="true" xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" />
              <FinalMobileUrls xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                <a:string>http://mobile.contoso.com/womenshoesale</a:string>
              </FinalMobileUrls>
              <FinalUrls xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                <a:string>http://www.contoso.com/womenshoesale</a:string>
              </FinalUrls>
              <TrackingUrlTemplate i:nil="true" />
              <UrlCustomParameters xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10">
                <a:Parameters>
                  <a:CustomParameter>
                    <a:Key>promoCode</a:Key>
                    <a:Value>PROMO1</a:Value>
                  </a:CustomParameter>
                  <a:CustomParameter>
                    <a:Key>season</a:Key>
                    <a:Value>summer</a:Value>
                  </a:CustomParameter>
                </a:Parameters>
              </UrlCustomParameters>
            </SiteLink>
            <SiteLink>
              <Description1 i:nil="true" />
              <Description2 i:nil="true" />
              <DestinationUrl i:nil="true" />
              <DevicePreference i:nil="true" />
              <DisplayText>Women's Shoe Sale 2</DisplayText>
              <FinalAppUrls i:nil="true" xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10" />
              <FinalMobileUrls xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                <a:string>http://mobile.contoso.com/womenshoesale</a:string>
              </FinalMobileUrls>
              <FinalUrls xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                <a:string>http://www.contoso.com/womenshoesale</a:string>
              </FinalUrls>
              <TrackingUrlTemplate i:nil="true" />
              <UrlCustomParameters xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10">
                <a:Parameters>
                  <a:CustomParameter>
                    <a:Key>promoCode</a:Key>
                    <a:Value>PROMO2</a:Value>
                  </a:CustomParameter>
                  <a:CustomParameter>
                    <a:Key>season</a:Key>
                    <a:Value>summer</a:Value>
                  </a:CustomParameter>
                </a:Parameters>
              </UrlCustomParameters>
            </SiteLink>
          </SiteLinks>
        </AdExtension>
      </AdExtensions>
    </AddAdExtensionsRequest>
  </s:Body>
</s:Envelope>

我希望这有帮助!


这篇关于附加链接添加自定义参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 10:16