Google Groups Home
Help | Sign in
undefined APIlityUser instance when calling getAllJobs()
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
excessivedemon@gmail.com  
View profile
 More options Jun 24, 7:50 pm
From: "excessivede...@gmail.com" <excessivede...@gmail.com>
Date: Tue, 24 Jun 2008 16:50:47 -0700 (PDT)
Local: Tues, Jun 24 2008 7:50 pm
Subject: undefined APIlityUser instance when calling getAllJobs()
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?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
akomasin...@gmail.com  
View profile
 More options Jun 30, 9:33 am
From: akomasin...@gmail.com
Date: Mon, 30 Jun 2008 06:33:05 -0700 (PDT)
Local: Mon, Jun 30 2008 9:33 am
Subject: Re: undefined APIlityUser instance when calling getAllJobs()
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"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
excessivedemon@gmail.com  
View profile
 More options Jul 14, 12:36 am
From: "excessivede...@gmail.com" <excessivede...@gmail.com>
Date: Sun, 13 Jul 2008 21:36:04 -0700 (PDT)
Local: Mon, Jul 14 2008 12:36 am
Subject: Re: undefined APIlityUser instance when calling getAllJobs()
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:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
excessivedemon@gmail.com  
View profile
 More options Jul 16, 2:19 am
From: "excessivede...@gmail.com" <excessivede...@gmail.com>
Date: Tue, 15 Jul 2008 23:19:15 -0700 (PDT)
Local: Wed, Jul 16 2008 2:19 am
Subject: Re: undefined APIlityUser instance when calling getAllJobs()
I found that the error appears to be related to the inclusion of the
apility.php file. if require_once for apility.php is from within
constructor (not oustide the class declaration), I get the following
error
instead:

Undefined index:  _transient

Any ideas on this? Wouldn't there be a way to specify to APIlity not
to
use nusoap if a user is running on PHP5 so calls will be done via
PHP5's
soap extension?

On 14 Hul, 12:36, "excessivede...@gmail.com"


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
excessivedemon@gmail.com  
View profile
 More options Jul 16, 2:20 am
From: "excessivede...@gmail.com" <excessivede...@gmail.com>
Date: Tue, 15 Jul 2008 23:20:15 -0700 (PDT)
Local: Wed, Jul 16 2008 2:20 am
Subject: Re: undefined APIlityUser instance when calling getAllJobs()
I found that the error appears to be related to the inclusion of the
apility.php file. if require_once for apility.php is from within
constructor (not oustide the class declaration), I get the following
error
instead:

Undefined index:  _transient

Any ideas on this? Wouldn't there be a way to specify to APIlity not
to
use nusoap if a user is running on PHP5 so calls will be done via
PHP5's
soap extension?

On 14 Hul, 12:36, "excessivede...@gmail.com"


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
excessivedemon@gmail.com  
View profile
 More options Jul 16, 2:20 am
From: "excessivede...@gmail.com" <excessivede...@gmail.com>
Date: Tue, 15 Jul 2008 23:20:31 -0700 (PDT)
Local: Wed, Jul 16 2008 2:20 am
Subject: Re: undefined APIlityUser instance when calling getAllJobs()
I found that the error appears to be related to the inclusion of the
apility.php file. if require_once for apility.php is from within
constructor (not oustide the class declaration), I get the following
error
instead:

Undefined index:  _transient

Any ideas on this? Wouldn't there be a way to specify to APIlity not
to
use nusoap if a user is running on PHP5 so calls will be done via
PHP5's
soap extension?

On 30 Hun, 21:33, akomasin...@gmail.com wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google