Hi,

To address your questions:

1) Moving service creation outside the loops ensures one WSDL request
per execution.  Enabling WSDL caching ensures one WSDL request per day
or so.  In some versions of PHP WSDL caching may lead to strange
behavior, so use cautiously.

2) These services are just like any other PHP objects and you can
create them wherever you wish in your code.

Best,
- Eric

On Aug 7, 9:25 am, phpguy <[email protected]> wrote:
> I have just a couple remaining questions.
>
> 1.  Is there a best practice (advantages to disadvantages) between
> enabling WSDL caching vs placing the service outside of the loop?
>
> 2.  I have a loop embedded within another loop, can I place all the
> service calls above the top-level loop?  Or can I even place them at
> the top of the code (similar to declaring variables at the very
> beginning)?
>
> Thanks again!
>
> On Aug 6, 5:25 pm, AdWords API Advisor <[email protected]>
> wrote:
>
>
>
> > Hi,
>
> > The following line is the one that creates the service and should be
> > outside of the loop:
>
> >   $adGroupAdService = $user->GetAdGroupAdService('v200909');
>
> > Alternatively you can enable WSDL caching to store the WSDL locally:
>
> >  http://code.google.com/p/google-api-adwords-php/source/browse/trunk/s...
>
> > Best,
> > - Eric Koleda, AdWords API Team
>
> > On Aug 6, 10:28 am, phpguy <[email protected]> wrote:
>
> > > In reference to this 
> > > post:http://groups.google.com/group/adwords-api/browse_thread/thread/8db67...
>
> > > I received the same error but am including the service inside of the
> > > loop.  The error occurs occasionally but when you said
> > > "We recommend that you create the service only once outside of the
> > > loop and reuse it for every request."
>
> > > Given this code:
>
> > > [start of loop]
> > > $adGroupAdService = $user->GetAdGroupAdService('v200909');
> > > $adGroupId = (float) $adGroup->id;
> > > $selector = new AdGroupAdSelector();
> > > ...
> > > [end of loop]
>
> > > - which parts need to be outside the loop (above the [start of loop])?
> > > - does this apply for all types of operations?  (e.g.
> > > campaignselector, adgroupselector, adgroupoperation,
> > > getcampaignservice, etc)
> > > - can i just clarify them all at the very top like a variable?
>
> > > Thanks for your help!

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to