apility.php file. if require_once for apility.php is from within
<excessivede
...@gmail.com> wrote:
> I did a bunch or trials, tried running on other servers, etc.. but the
> same issue persist. The only time I do not get this issue is if I call
> the google's adwords api directly via PHP5's soap and not passing
> through the apility classes. :(
> On Jun 30, 9:33 pm, akomasin...@gmail.com wrote:
> > I don't have any ideas on the solution, but I only encountered this
> > error intermittently.
> > I think the reason that initiating a new APIlity user does not help is
> > that the SOAP clients are the same no matter how many apility users
> > you create.
> > I think the SOAPclient has lost the connection, so you might want to
> > check and see if any of your routers or systems rapidly close IP
> > connections.
> > On Jun 24, 7:50 pm, "excessivede...@gmail.com"
> > <excessivede...@gmail.com> wrote:
> > > when the method getAllJobs() is called after downloadXMLReport() [or
> > > vise
> > > versa] on the APIlityUser instance, the APIlityUser instance suddenly
> > > becomes undefined, even when creating a new APIlityUser instance on
> > > the
> > > second call. Here is a sample class:
> > > class Adwords
> > > {
> > > private static function getAPIlityUserInstance($email=null,
> > > $password=null, $client_email=null, $developer_token=null,
> > > $application_token=null)
> > > {
> > > $apility_user = new APIlityUser();
> > > if ($email)
> > > {
> > > $apility_user->setEmail($email);}
> > > if ($password)
> > > {
> > > $apility_user->setPassword($password);}
> > > if ($client_email)
> > > {
> > > $apility_user->setClientEmail($client_email);}
> > > if ($developer_token)
> > > {
> > > $apility_user->setDeveloperToken($developer_token);}
> > > if ($application_token)
> > > {
> > > $apility_user->setApplicationToken($application_token);}
> > > return $apility_user;
> > > }
> > > /**
> > > * Function to return an XML report by id
> > > * @params string report id number
> > > * @returns string xml report
> > > **/
> > > public function getXMLReportById($report_id)
> > > {
> > > $apility_user = Adwords::getAPIlityUserInstance();
> > > return $apility_user->downloadXMLReport($report_id);
> > > }
> > > /**
> > > * function to return a report by name (just returns all reports for
> > > now
> > > for testing purposes
> > > **/
> > > public function getXMLReportByName()
> > > {
> > > $apility_user = Adwords::getAPIlityUserInstance();
> > > return $apility_user->getAllJobs();
> > > }
> > > }
> > > upon doing unit testing:
> > > class AdwordsTest extends PHPUnit_Framework_TestCase
> > > {
> > > private $fixtures = null;
> > > public function setUp()
> > > {
> > > $this->fixtures = new Adwords();
> > > }
> > > /* It always would not work if one function is called after the other
> > > (getJobs + getXMLReportById)*/
> > > public function testGetXMLReportByName()
> > > {
> > > var_dump($this->fixtures->getXMLReportByName());
> > > }
> > > public function testGetXMLReportByReportId()
> > > {
> > > $report_id = '356135051';
> > > var_dump($this->fixtures->getXMLReportById($report_id));
> > > //$this->assertEquals(true,
> > > $this->fixtures->getXMLReportById($report_id));
> > > }
> > > }
> > > It would fail on testGetXMLReportByReportId [since
> > > testGetXMLReportByReportId is the second call and
> > > testGetXMLReportByName is
> > > the first; it only works on the first call]. Here is the error from
> > > PHPUnit:
> > > 1) testGetXMLReportByReportId(AdwordsTest)
> > > Trying to get property of non-object
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > nusoap.p
> > > hp:204
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > nusoap.p
> > > hp:2047
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > nusoap.p
> > > hp:6756
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > nusoap.p
> > > hp:6674
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > Report.p
> > > hp:1024
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > APIlityU
> > > ser.php:97
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/
> > > adwords.class.php:51
> > > /var/websites/amie/tests/SystemCore/ExternalApi/Adwords/
> > > adwordsTest.class.p
> > > hp:26
> > > /var/websites/amie/runtests.php:65
> > > If the order of the functions in the test were inverted (call
> > > testGetXMLReportByReportID first before calling
> > > testGetXMLReportByName),
> > > testGetXMLReportByName would fail.
> > > 1) testGetXMLReportByName(AdwordsTest)
> > > Trying to get property of non-object
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > nusoap.p
> > > hp:204
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > nusoap.p
> > > hp:2047
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > nusoap.p
> > > hp:6756
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > nusoap.p
> > > hp:6674
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > Report.p
> > > hp:1171
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/APIlity/lib/
> > > APIlityU
> > > ser.php:97
> > > /var/websites/amie/amie/SystemCore/ExternalApi/Adwords/
> > > adwords.class.php:61
> > > /var/websites/amie/tests/SystemCore/ExternalApi/Adwords/
> > > adwordsTest.class.p
> > > hp:28
> > > /var/websites/amie/runtests.php:65
> > > This bug happens whether or not a new instance of APIlity user is
> > > created.
> > > It would always fail on the second (and succeeding) calls - only the
> > > first
> > > call would work.
> > > Any ideas on this?