I got this error even when I'm coding as what the API samples do after 2 
weeks of running the .NET web app:

Google.Api.Ads.AdWords.Lib.
AdWordsApiException: 
An API exception has occurred. See ApiException and InnerException fields 
for more details. 
---> System.Web.Services.Protocols.SoapException: *
AuthenticationError.GOOGLE_ACCOUNT_COOKIE_INVALID* @ 
Service[CampaignService.mutate] 
at 
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
 
message, WebResponse response, Stream responseStream, Boolean asyncCall) 
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String 
methodName, Object[] parameters) 
at Google.Api.Ads.Common.Lib.AdsSoapClient.MakeApiCall(String methodName, 
Object[] parameters) 
--- End of inner exception stack trace --- 
at Google.Api.Ads.Common.Lib.AdsSoapClient.MakeApiCall(String methodName, 
Object[] parameters) 
at Google.Api.Ads.AdWords.Lib.AdWordsSoapClient.MakeApiCall(String 
methodName, Object[] parameters) 
at Google.Api.Ads.Common.Lib.AdsSoapClient.Invoke(String methodName, 
Object[] parameters) 
at 
Google.Api.Ads.AdWords.v201109.CampaignService.mutate(CampaignOperation[] 
operations) 
at SemUpdateBiz.SEMManager.ChangeGoogleCampaignStatus(googleNameAndID 
thisCampaign, String campaign_email, String campaign_password, String 
clientEmail, CampaignStatus newStatus)

The following is ChangeGoogleCampaignStatus() function. I use it to pause a 
campaign when that campaign doesn't have any location targets.

private Campaign *ChangeGoogleCampaignStatus*(long campaignId, string 
campaign_email, string campaign_password, string clientEmail, 
CampaignStatus newStatus)
        {
            try
            {
                Dictionary<string, string> headers = new Dictionary<string, 
string>();
                headers.Add("email", campaign_email);
                headers.Add("password", campaign_password);
                headers.Add("useragent", 
ConfigurationManager.AppSettings["useragent"]);
                headers.Add("developerToken", 
ConfigurationManager.AppSettings["developerToken"]);

                AdWordsUser user = new AdWordsUser(headers);
                CampaignService campaignService = 
(CampaignService)user.GetService(AdWordsService.v201109.CampaignService);

                Campaign campaign = new Campaign();
                campaign.id = campaignId;
                campaign.status = newStatus;

                CampaignOperation operation = new CampaignOperation();
                operation.@operator = Operator.SET;
                operation.operand = campaign;

                CampaignReturnValue result = campaignService.mutate((new 
CampaignOperation[] { operation }));
                return campaign;
            }
            catch (Exception ex)
            {
                Logger.LogThis(ex.ToString(), Logger.MsgTypeEnum.Error);
            }
            return null;
        }
     
This is from the App.config:

<AdWordsApi>
    <add key="LogPath" value="D:\"/>
    <add key="LogToConsole" value="false"/>
    <add key="LogToFile" value="false"/>
    <add key="MaskCredentials" value="true"/>
    <add key="LogErrorsOnly" value="false"/>
    <add key="ProxyServer" value=""/>
    <add key="ProxyUser" value=""/>
    <add key="ProxyPassword" value=""/>
    <add key="ProxyDomain" value=""/>
    <add key="Timeout" value="600000"/>
    <add key="EnableGzipCompression" value="true"/>
    <add key="UserAgent" value="xxx"/>
    <add key="DeveloperToken" value="xxx"/>
    <add key="AuthorizationMethod" value="ClientLogin" />
  </AdWordsApi>

Anyone has a recommendation on the issue? Thanks.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to