BatchJobService results can't be deserialized (PHP)

78 views
Skip to first unread message

Péter Gerő

unread,
Jan 21, 2016, 9:14:02 AM1/21/16
to AdWords API Forum
Hi,

Our tool uses the PHP client lib. and even running the sample "AddCompleteCampaignUsingBatchJob.php" an exception is thrown when there are errors in the downloaded result set, so basically it cant process the results.

I have traced it back to XmlDeserializer.php utility. 
The error message says: "Property _parameterMap does not exist".

To be more specific when it tries to get the errorString property of a child of ApiError class (ConvertElementToObject method last section), the hasProperty() call returns false, then it tries to get the _parameterMap of ApiError, which fails, and throws the above mentioned error.

Am I missing / have overlooked something here?

Thanks,

Peter Gerő

uku...@mail.ru

unread,
Mar 1, 2016, 9:21:12 AM3/1/16
to AdWords API Forum
Hi,

I have the same problem.
In BatchJob request I got result:
$xmlResponse = "<?xml version="1.0" encoding="UTF-8"?>
<mutateResponse xmlns="https://adwords.google.com/api/adwords/cm/v201601">
    <rval><result>...</result><index>0</index></rval>
    <rval><result>...</result><index>1</index></rval>
    <rval>
        <errorList>
            <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AdGroupServiceError">
                <fieldPath>operations[2].operand.name</fieldPath>
                <trigger>Группа - 20160225</trigger>
                <errorString>AdGroupServiceError.DUPLICATE_ADGROUP_NAME</errorString>
                <ApiError.Type>AdGroupServiceError</ApiError.Type>
                <reason>DUPLICATE_ADGROUP_NAME</reason>
            </errors>
        </errorList>
        <index>2</index>
    </rval>
</mutateResponse>"
Then I try to deserialize it:
$deserializer = new XmlDeserializer(BatchJobUtils::$CLASS_MAP);
 try{
        $mutateResponse = $deserializer->ConvertXmlToObject($xmlResponse);
}
catch(Exception $e){
    $this->eHandler->MyExit(' GetResult/intro ', true, $e);
 }

and got:
System: Property _parameterMap does not exist

The problem appear in src\Google\Api\Ads\AdWords\Util\XmlDeserializer.php in line 127
$parameterMapProp = $parentClass->getProperty('_parameterMap');

my experiments show:
1. $elementClass is AdGroupServiceError. It has properties:
      $this->reason = $reason;
      $this->fieldPath = $fieldPath;
      $this->trigger = $trigger;
      $this->errorString = $errorString;
      $this->ApiErrorType = $ApiErrorType;
2. $parentClass is ApiError. It has prorerties:
      $this->fieldPath = $fieldPath;
      $this->trigger = $trigger;
      $this->errorString = $errorString;
      $this->ApiErrorType = $ApiErrorType;
3. When I call
$elementClass->hasProperty($name) where
$name = '
reason' ||
$name = 'fieldPath' ||
$name = '
trigger'
result is true
When

$name = 'errorString' ||
$name = '
ApiErrorType'
result is false

4. Class
ApiError has property '_parameterMap', but

$parameterMapProp = $parentClass->getProperty('_parameterMap'); gives error.
I can't understand, why. I think, it's some mistake in API, but can't localize one.

Dolganov Alexey.

Anthony Madrigal

unread,
Mar 1, 2016, 4:36:10 PM3/1/16
to AdWords API Forum
Hi Dolganov,

The error you are getting suggests that one of the ad groups you are creating has the same name as an ad group you already have. 

The issue Peter mentioned was fixed by our team a month ago.

If you are still receiving errors after you change the ad group name, please Reply privately to author your SOAP request and response.

Regards,
Anthony
AdWords API Team

Thanet Knack Praneenararat (AdWords API Team)

unread,
Mar 2, 2016, 9:10:17 PM3/2/16
to AdWords API Forum
Hello Alexey,

I can't reproduce your issue.
One potential cause that I can think of now is the ApiError class may not be included or required properly.

The following is the code I tried mimicking your code using PHP client lib v8.0.0.
I put my file under v201601.

There was no errors thrown.

<?php
require_once 'init.php';
require_once 'Google/Api/Ads/AdWords/Util/XmlDeserializer.php';
require_once 'Google/Api/Ads/AdWords/Util/v201601/BatchJobUtils.php';

$xmlResponse = '<?xml version="1.0" encoding="UTF-8"?>
    <rval><result>...</result><index>1</index></rval>
    <rval>
        <errorList>
            <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AdGroupServiceError">
                <fieldPath>operations[2].operand.name</fieldPath>
                <trigger>Группа - 20160225</trigger>
                <errorString>AdGroupServiceError.DUPLICATE_ADGROUP_NAME</errorString>
                <ApiError.Type>AdGroupServiceError</ApiError.Type>
                <reason>DUPLICATE_ADGROUP_NAME</reason>
            </errors>
        </errorList>
        <index>2</index>
    </rval>
</mutateResponse>';

$deserializer = new XmlDeserializer(BatchJobUtils::$CLASS_MAP);
$mutateResponse = $deserializer->ConvertXmlToObject($xmlResponse);
var_dump($mutateResponse);

Could you please try on your side?
If you're still faced with the issue, could you please send your code snippet by Reply privately to author or attach it here (if it's not confidential)?

Best,
Thanet, AdWords API Team

umer....@purelogics.net

unread,
Jan 23, 2019, 5:39:49 PM1/23/19
to AdWords API and Google Ads API Forum
Hi,

I want to create the same adgroup for multiple campaigns. e.g.
adgroup1 should be in campaign1, campaign2 and campaign3 as well. 

Can anyone please guide me regarding this. 

I got this error
2019-01-23_1258.png

googleadsapi...@google.com

unread,
Jan 24, 2019, 12:08:26 AM1/24/19
to AdWords API and Google Ads API Forum
Hi Umer,

For better tracking of your concern. Could you create a brand new post on your issue as this thread was an old post. We will assist you on the new thread that you will create.

Regards,
Luis
AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/afe71908-1fdb-45db-87a1-17726f7d326d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages