Hi David,

I'm glad to hear you have it working.  When the v13 ReportService is
eventually deprecated it will be given our standard 4-6 month sunset
clock.

Best,
- Eric

On Feb 18, 11:10 am, David <cont...@akamarketing.com> wrote:
> Thanks Eric, got it working now. It was a sneaky one so I won't beat
> myself up over it too much .
>
> cheers.
>
> Migration to v2009 complete. Hopefully we get 6 month sunset on
> reports service etc.
>
> On Feb 18, 3:14 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
> wrote:
>
>
>
> > Hi David,
>
> > Although you created a CampaignCriterionIdFilter[] of size 1, you
> > never actually created a CampaignCriterionIdFilter object to put in
> > that array.
>
> > // You had this.
> > CampaignCriterionIdFilter[] ccIDfilters = new
> > CampaignCriterionIdFilter[1];
>
> > // Now add this.
> > ccIDfilters[0] = new CampaignCriterionIdFilter();
>
> > // You had this.
> > ccIDfilters[0].campaignId = campaignID;
>
> > Best,
> > - Eric
>
> > On Feb 18, 9:25 am, David <cont...@akamarketing.com> wrote:
>
> > > Hi Eric and all. I've set up soap logging but nothing goes into the
> > > log as the error occurs before the campaignTargetService.get method is
> > > called. http log and soap log is both empty. I've isolated campaign
> > > negative keywords into a test page but can confirm logging works as
> > > stuff is being logged from my main app.
>
> > > If I'm doing someone crazy wrong and stupid well then my bad but I
> > > can't for the life of me get this to work.
>
> > > My method for campaign neg keywords is :
>
> > > public static int getCampaignNegativeKWCountV2009(string campaignName,
> > > long campaignID, string accountIDstring)
> > >     {
> > >         Debug.WriteLine("camp name is " +  campaignName + " ||| camp
> > > id is = " + campaignID.ToString());
>
> > >         AdWordsUser user = new AdWordsUser();
> > >         CampaignCriterionService campaignCriterionService =
> > > (CampaignCriterionService)user.GetService(AdWordsService.v200909.CampaignCr
> > >  iterionService);
> > >         campaignCriterionService.RequestHeader.clientCustomerId =
> > > accountIDstring;
>
> > >         CampaignCriterionSelector ccs = new
> > > CampaignCriterionSelector();
>
> > >         //filter which campaigns you want data for
> > >         CampaignCriterionIdFilter[] ccIDfilters = new
> > > CampaignCriterionIdFilter[1];
> > >         ccIDfilters[0].campaignId = campaignID;
> > > ccIDfilters[0].campaignIdSpecified = true; //ERROR HERE
>
> > >         //associate selector with filters
> > >         ccs.idFilters = ccIDfilters;
>
> > >         //get what you want
> > >         CampaignCriterion[] criterions =
> > > (CampaignCriterion[])campaignCriterionService.get(ccs).entries;
>
> > >         //// no campaign level neg KWs
> > >         if (criterions == null)
> > >             return 0;
>
> > >         int keywordCount = 0;
> > >         for (int i = 0; i < criterions.Length; i++)
> > >             //confirm the negative criteria of a KW and not a URL
> > > (content network)
> > >             if (criterions[i].GetType().Name == "Keyword") keywordCount
> > > ++;
>
> > >         return keywordCount;
> > >     }
>
> > > The error I get is
>
> > > Object reference not set to an instance of an object.  at this line.
> > > ccIDfilters[0].campaignId = campaignID;
> > > ccIDfilters[0].campaignIdSpecified = true;
>
> > > campaigncritierionselectors expects an array of
> > > CampaignCriterionIdFilter's. So I create an array with a capcity of 1
> > > and fill its zero'th element with a long which I know is not null and
> > > is proper..  but ccIDfilters doesn't seem to be getting created
> > > propertly. I went into the CampaignCriterionIdFilter defintion code
> > > and didn't see a constructor but its a partial class so that's prob
> > > why.
>
> > > I'm sure its something stupid I'm missing but a working .net example
> > > would be great. I'm using .net client lib v7. The new one.
>
> > > cheers.
>
> > > On Feb 17, 4:37 pm, David <cont...@akamarketing.com> wrote:
>
> > > > Thanks Eric. I'll try and set up SOAP logging. Can you tell me though
> > > > is my code correct?
>
> > > > Rgds
> > > > david.
>
> > > > On Feb 17, 3:57 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
> > > > wrote:
>
> > > > > Hi David,
>
> > > > > When you have problems like this its always best to look at the SOAP
> > > > > request and response XML.  Please post this XML to this thread and
> > > > > that should shed some light on the problem.
>
> > > > > Best,
> > > > > - Eric Koleda, AdWords API Team
>
> > > > > On Feb 16, 9:53 am, David <cont...@akamarketing.com> wrote:
>
> > > > > > Thanks again Ursula. I'm using the .net client library anyhow but
> > > > > > understand that what you have is still pretty much what I'm doing. 
> > > > > > The
> > > > > > methods do seem different slightly though which I find strange 
> > > > > > because
> > > > > > the end soap web service is the same one for both java and .net, but
> > > > > > the surrounding framework is obviously different for one programming
> > > > > > language v another.  I don't really know what or if
> > > > > > campaignIDspecified is used for.
>
> > > > > > But the basic process between your code and mine is the same and is 
> > > > > > :
>
> > > > > > > > //create service
> > > > > > > > //create selector
> > > > > > > > //create campaign filters based on campaignID
> > > > > > > > //associate filters with selector
> > > > > > > > //associate (pass in) selector with service get call.
>
> > > > > > I don't think im populating filters incorrectly..
>
> > > > > >  > //THINK I'M GOING WRONG HERE - campaignID is a long
>
> > > > > > > > CampaignCriterionIdFilter[] ccIDfilters = new
> > > > > > > > CampaignCriterionIdFilter[1];
> > > > > > > > ccIDfilters[0].campaignId = campaignID;
> > > > > > > > ccIDfilters[0].campaignIdSpecified = true;
>
> > > > > > > > //ADDING THE FILTERS TO THE SELECTOR I CREATED ABOVE
> > > > > > > > ccs.idFilters = ccIDfilters;
>
> > > > > > Any Google reps know where I'm going wrong. The filters object of 
> > > > > > the
> > > > > > selector is always null.
>
> > > > > > On Feb 16, 2:28 pm, Ursula <ursula.kellm...@gmail.com> wrote:
>
> > > > > > > Hi David,
>
> > > > > > > Here is a snippet of my code that works ( java).  Do you have a 
> > > > > > > wrong
> > > > > > > import or something for the CampaignCriterionIdFilter?  I don't 
> > > > > > > see a
> > > > > > > property call campaignIdSpecified in my source.
>
> > > > > > > //AdwordsNetworkAccount is a wrapper around the client api 
> > > > > > > adwordsUser
> > > > > > > object
>
> > > > > > >  public List<NegativeCampaignCriterion> 
> > > > > > > getCampaignNegativeKeywords(
>
> > > > > > > AdwordsNetworkAccount adwordsNetworkAccount,
>
> > > > > > > long[] campaignChannelIDs)
> > > > > > > CampaignCriterionServiceInterface service =
> > > > > > >                 
> > > > > > > getCampaignCriterionService(adwordsNetworkAccount);
>
> > > > > > >             CampaignCriterionSelector selector = new
> > > > > > > CampaignCriterionSelector();
>
> > > > > > >             // Initialize the array of filters
> > > > > > >             CampaignCriterionIdFilter[] criterionFilter =
> > > > > > >                 new
> > > > > > > CampaignCriterionIdFilter[campaignChannelIDs.length];
> > > > > > >             selector.setIdFilters(criterionFilter);
>
> > > > > > >             CampaignCriterionIdFilter filter = null;
> > > > > > >             for (int i = 0; i < campaignChannelIDs.length; i++)
> > > > > > >             {
> > > > > > >                 filter = new CampaignCriterionIdFilter();
> > > > > > >                 filter.setCampaignId(campaignChannelIDs[i]);
> > > > > > >                 selector.setIdFilters(i, filter);
> > > > > > >             }
>
> > > > > > >             CampaignCriterionPage criterion = 
> > > > > > > service.get(selector);
>
> > > > > > > On Feb 16, 5:18 am, David <cont...@akamarketing.com> wrote:
>
> > > > > > > > Hi Ursula, thanks for your help, however thats pretty much what 
> > > > > > > > I'm
> > > > > > > > attempting to do already. I don't see a selector.setIdFilters 
> > > > > > > > method I
> > > > > > > > just see a selector.IdFilters method.
>
> > > > > > > > I'm trying the below.
> > > > > > > > //create service
> > > > > > > > //create selector
> > > > > > > > //create campaign filters based on campaignID
> > > > > > > > //associate filters with selector
> > > > > > > > //associate (pass in) selector with service get call.
>
> > > > > > > > Sample of my code is below.
>
> > > > > > > > AdWordsUser user = new AdWordsUser(headers);
> > > > > > > > CampaignCriterionService campaignCriterionService =
> > > > > > > > (CampaignCriterionService)user.GetService(AdWordsService.v200909.CampaignCr
> > > > > > > >  iterionService);
>
> > > > > > > > //SELECTOR CREATED HERE CALLED CCS
> > > > > > > > CampaignCriterionSelector ccs = new CampaignCriterionSelector();
>
> > > > > > > > //THINK I'M GOING WRONG HERE - campaignID is a long
> > > > > > > > CampaignCriterionIdFilter[] ccIDfilters = new
> > > > > > > > CampaignCriterionIdFilter[1];
> > > > > > > > ccIDfilters[0].campaignId = campaignID;
> > > > > > > > ccIDfilters[0].campaignIdSpecified = true;
>
> > > > > > > > //ADDING THE FILTERS TO THE SELECTOR I CREATED ABOVE
> > > > > > > > ccs.idFilters = ccIDfilters;
>
> > > > > > > > //PASSING THE SELECTOR IN TO THE MAIN GET CALL
> > > > > > > > CampaignCriterion[] criterions =
> > > > > > > > (CampaignCriterion[])campaignCriterionService.get(ccs).entries;
>
> > > > > > > > Has anyone got any example code from this?
>
> > > > > > > > thanks in advance.
>
> > > > > > > > On Feb 15, 10:30 pm, Ursula <ursula.kellm...@gmail.com> wrote:
>
> > > > > > > > > You need to create a CampaignCriterionSelector as well :
>
> > > > > > > > >   CampaignCriterionSelector selector = new
> > > > > > > > > CampaignCriterionSelector();
>
> > > > > > > > > and then add the  CampaignCriterionIdFilter that you created:
>
> > > > > > > > > selector.setIdFilters(  ccIDfilters)
>
> > > > > > > > > then pass this selector to the get method.
> > > > > > > > > campaignCriterionService.get(selector).entries;
>
> > > > > > > > > Ursula Kellmann
>
> > > > > > > > > On Feb 15, 6:11 am, David <cont...@akamarketing.com> wrote:
>
> > > > > > > > > > Anyone got any ideas. Anyone done this before?
>
> > > > > > > > > > On Feb 13, 4:35 pm, David <cont...@akamarketing.com> wrote:
>
> > > > > > > > > > > CampaignCriterionIdFilter[] ccIDfilters = new...
>
> read more »

-- 
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-...@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