Error: The size necessary to buffer the XML content exceeded the buffer quota. RRS feed

  • Question

  • I'm updating from v4 to v5.  I have added all the web services, run the svcutil.exe, imported the necessary files and I keep getting the exception "The size necessary to buffer the XML content exceeded the buffer quota" when I'm running this script.  Below is the code and app.config.  Any ideas why I would be getting this error? and possibel solutions.


    Keyword[] kw = a.GetKeywordsByAdGrps(Convert.ToInt32(msnOrder.Id));

    foreach (Keyword k in kw)


    k.Id = k.Id;

    if (regContent.IsMatch(msnCamp.Name))


    k.ContentMatchBid = (Convert.ToDouble(r_msn_orders[0]["Bid"]) * 1.0);


    else if (regBroad.IsMatch(msnCamp.Name))


    k.BroadMatchBid = (Convert.ToDouble(r_msn_orders[0]["Bid"]) * 1.0);


    else if (regExact.IsMatch(msnCamp.Name))


    k.ExactMatchBid = (Convert.ToDouble(r_msn_orders[0]["Bid"]) * 1.0);




    k.PhraseMatchBid = (Convert.ToDouble(r_msn_orders[0]["Bid"]) * 1.0);


    logErr("<span style='padding-left: 60px; font-size: 8pt'>Updated Keyword: " + k.Text + " - - - Content: " + k.ContentMatchBid + " Broad: " + k.BroadMatchBid + " Exact: " + k.ExactMatchBid + " Phrase: " + k.PhraseMatchBid + "</span>");


    a.UpdateKeywords(Convert.ToInt32(msnOrder.Id), kw);




    I pass the adgroup id and keyword[] to this method:




    CampaignManagementServiceClient svcCampMgt;

    svcCampMgt = new CampaignManagementServiceClient("BasicHttpBinding_ICampaignManagementService");

    //svcCampMgt = new CampaignManagementServiceClient();

    adCenter.CampaignManagementService.ApplicationToken appToken;

    adCenter.CampaignManagementService.UserCredentials userCreds;

    adCenter.CampaignManagementService.DeveloperToken devToken;

    appToken = new adCenter.CampaignManagementService.ApplicationToken();

    devToken = new adCenter.CampaignManagementService.DeveloperToken();

    userCreds = new adCenter.CampaignManagementService.UserCredentials();

    appToken.Value = appTokenValue;

    devToken.Value = "XXXXXXXX";

    userCreds.Username = "XXXXXXX";

    userCreds.Password = "XXXXXXX";

    UpdateKeywordsRequest updateKWRequest;

    UpdateKeywordsResponse updateKWResponse;

    updateKWRequest = new UpdateKeywordsRequest(appToken, null, devToken, userCreds, AdGrpID, keywords);

    updateKWResponse = svcCampMgt.UpdateKeywords(updateKWRequest);



    catch (FaultException<adCenter.CampaignManagementService.ApiFaultDetail> fault)


    adCenter.CampaignManagementService.ApiFaultDetail detail = fault.Detail;

    // Display any service operation error information.

    foreach (adCenter.CampaignManagementService.OperationError opError in detail.OperationErrors)





    // Add your additional exception-handling code here.


    catch (Exception e)






    Its been chopped up.

    <binding name="BasicHttpBinding_ICampaignManagementService" closeTimeout="00:01:00"

    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

    maxBufferSize="655360000" maxBufferPoolSize="524288" maxReceivedMessageSize="655360000"

    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"


    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

    maxBytesPerRead="4096" maxNameTableCharCount="16384" />

    <security mode="Transport">

    <transport clientCredentialType="None" proxyCredentialType="None"

    realm="" />

    <message clientCredentialType="UserName" algorithmSuite="Default" />






    <behavior name="LargeQuotaBehavior">

    <dataContractSerializer maxItemsInObjectGraph="2147483647"/>





    <endpoint address="https://adcenterapi.microsoft.com/Api/Advertiser/V5.1/CampaignManagement/CampaignManagementService.svc"

    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICampaignManagementService"


    name="BasicHttpBinding_ICampaignManagementService" behaviorConfiguration="LargeQuotaBehavior" />

    Thursday, September 4, 2008 5:44 PM

All replies

  • Thursday, September 4, 2008 6:37 PM
  • I see that you have indeed implemented a behavior. So how many keywords are you attempting? And what has been "chopped up"?

    Jeff Dillon, API Support


    Thursday, September 4, 2008 6:41 PM
  • Thats a snipet from my app.config... left out some of the other bindings. A total of 926 keywords on one call.

    Yeah I saw your article on handling the large arrays... thats why I included the app.conig snippet.


    Thursday, September 4, 2008 6:51 PM
  • Is there any way where I can just pass 1 keyword at a time for these huge lists that I have?


    The problem is our accounts like google adwords, we can make a bid adjustment to the adgroup and it defaults all the keywords at one time.  Here I need to go through all the keywords of the account and adjust every keyword on an individual basis.


    Thursday, September 4, 2008 7:28 PM

    So I have tried a smaller adgroup campaign and I am now receiving:

    Invalid client data. Check the SOAP fault details for more information


    I am using the same credentials as the customermanagement service...

    Thursday, September 4, 2008 7:59 PM
  •   Here is the  request... I can't still see the response...


    <?xml version="1.0"?>
    <UpdateKeywordsRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ApplicationToken />
      <CustomerAccountId xsi:nil="true" />
          <BroadMatchBid xsi:nil="true" />
          <ContentMatchBid xsi:nil="true" />
          <EditorialStatus xsi:nil="true" />
          <PhraseMatchBid xsi:nil="true" />
          <Status xsi:nil="true" />




    Friday, September 5, 2008 7:49 PM
  • Use a https sniffer, like Fiddler, which is freely available here



    Tuesday, September 16, 2008 6:54 PM