Hi! I am using v201008 of adwords API with PHP 5.3.2-1ubuntu4.7 with
Suhosin-Patch. I would like to use
BulkMutateJobService.
I use this code:

class myBMJS
{

    private $version = 'v201008';
    private $user;
    private $service;
    private static $campaignId;
    private static $adGroupId1;


    public function __construct()
    {
        self::$campaignId = (float) '56395';
        self::$adGroupId1 = (float) '3000182751';

        $ext = '-sandbox';
        $this->user = new AdWordsUser(
                        dirname(__FILE__) . "/config/auth$ext.ini",
                        null, null, null, null, null, null,
                        dirname(__FILE__) . "/config/settings$ext.ini"
        );
        $this->user->LogDefaults();
        $this->service = $this->user->GetBulkMutateJobService($this-
>version);

    }//end __construct()

    public function SinglePartSingleStreamMultipleOperations()
    {
        $scopingEntityId =
                new EntityId('CAMPAIGN_ID', self::$campaignId);

        $operations = $this->CreateKeywordOperations(100);
        $operationStream = new OperationStream($scopingEntityId,
$operations);
        $request = new BulkMutateRequest(0, $operationStream);

        $job = new BulkMutateJob();
        $job->request = $request;
        $job->numRequestParts = 1;

        $job = $this->service->mutate(new JobOperation($job, 'ADD'));

        do {
            $jobs = $this->service->get(
                            new BulkMutateJobSelector(array($job-
>id)));
            $job = $jobs[0];
            sleep(5);
        } while ($job->status == 'PENDING' || $job->status ==
'PROCESSING');


        $jobs = $this->service->get(
                        new BulkMutateJobSelector(array($job->id),
NULL, 0));
        $job = $jobs[0];

        $operationResults =
                $job->result->operationStreamResults[0]-
>operationResults;



        for ($i = 0; $i < sizeof($operationResults); $i++) {
            $requestKeyword = $operations[$i]->operand->criterion;
            $resultKeyword =
                    $operationResults[0]->returnValue-
>AdGroupCriterion->criterion;
        }
        echo 'Done...'.PHP_EOL;
        return true;
    }//end SinglePartSingleStreamMultipleOperations()

    private function CreateKeywordOperations($num)
    {
        $operations = array();
        for ($i = 0; $i < $num; $i++) {
            $keyword = new Keyword('mars cruise ' . time(), 'BROAD');
            $adGroupCriterion = new BiddableAdGroupCriterion();
            $adGroupCriterion->adGroupId = self::$adGroupId1;
            $adGroupCriterion->criterion = $keyword;
            $operations[] =
                    new AdGroupCriterionOperation($adGroupCriterion,
NULL, 'ADD');
        }
        return $operations;
    }

When testing the script on sandbox I got this error message:
PHP Fatal error:  Uncaught SoapFault exception: [soap:Server]
[IdError.NOT_FOUND @ selector.jobIds[0]] in /home/turbod/www/arukereso/
lib/adwords-api/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php:179

The generated soap:

HTTP/1.1 200 OK

Content-Type: text/xml; charset=UTF-8

SOAPAction: ""

Content-Encoding: gzip

Transfer-Encoding: chunked

Date: Tue, 01 Mar 2011 10:39:53 GMT

Expires: Tue, 01 Mar 2011 10:39:53 GMT

Cache-Control: private, max-age=0

X-Content-Type-Options: nosniff

X-Frame-Options: SAMEORIGIN

X-XSS-Protection: 1; mode=block

Server: GSE


<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
  <soap:Header>
    <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/
v201008">
      <requestId>09921633df82adda4e7f579ca5d4b0ab</requestId>
      <operations>1</operations>
      <responseTime>1461</responseTime>
      <units>1</units>
    </ResponseHeader>
  </soap:Header>
  <soap:Body>
    <mutateResponse xmlns="https://adwords.google.com/api/adwords/cm/
v201008">
      <rval>
        <context>
          <authenticatedUserEmail>drbioget-...@konstruktor.hu</
authenticatedUserEmail>
          <effectiveCustomerId>1114264140</effectiveCustomerId>
        </context>
        <Job.Type>BulkMutateJob</Job.Type>
        <id>1219791627052937094</id>
        <policy/>
        <status>PENDING</status>
        <numRequestParts>1</numRequestParts>
        <numRequestPartsReceived>1</numRequestPartsReceived>
      </rval>
    </mutateResponse>
  </soap:Body>
</soap:Envelope>

[Mar 01 2011 11:39:54.000000 - INFO] POST /api/adwords/job/v201008/
BulkMutateJobService HTTP/1.1

Host: adwords-sandbox.google.com

Connection: Keep-Alive

User-Agent: PHP-SOAP/5.3.2-1ubuntu4.7, gzip

Accept-Encoding: gzip, deflate

Content-Encoding: gzip

Content-Type: text/xml; charset=utf-8

SOAPAction: ""

Content-Length: 570



<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="https://adwords.google.com/api/adwords/cm/
v201008" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <SOAP-ENV:Header>
    <ns1:RequestHeader xsi:type="ns1:RequestHeader">
      <ns1:authToken>*****</ns1:authToken>
      <ns1:clientEmail>client_2+drbioget-...@konstruktor.hu</
ns1:clientEmail>
      <ns1:developerToken>drbioget-...@konstruktor.hu++HUF</
ns1:developerToken>
      <ns1:userAgent>AwApi-PHP-2.4.1-Konstruktor Kft.</ns1:userAgent>
    </ns1:RequestHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:get>
      <ns1:selector>
        <ns1:jobIds>1219791627052937216</ns1:jobIds>
      </ns1:selector>
    </ns1:get>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


HTTP/1.1 500 Internal Server Error

Content-Type: text/xml; charset=UTF-8

Content-Encoding: gzip

Transfer-Encoding: chunked

Date: Tue, 01 Mar 2011 10:39:53 GMT

Expires: Tue, 01 Mar 2011 10:39:53 GMT

Cache-Control: private, max-age=0

X-Content-Type-Options: nosniff

X-Frame-Options: SAMEORIGIN

X-XSS-Protection: 1; mode=block

Server: GSE


<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
  <soap:Header>
    <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/
v201008">
      <requestId>2e3a67f31a9b186a2b8c28a9c41252f6</requestId>
      <operations>1</operations>
      <responseTime>160</responseTime>
      <units>1</units>
    </ResponseHeader>
  </soap:Header>
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>[IdError.NOT_FOUND @ selector.jobIds[0]]</
faultstring>
      <detail>
        <ApiExceptionFault xmlns="https://adwords.google.com/api/
adwords/cm/v201008">
          <message>[IdError.NOT_FOUND @ selector.jobIds[0]]</message>
          <ApplicationException.Type>ApiException</
ApplicationException.Type>
          <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:type="IdError">
            <fieldPath>selector.jobIds[0]</fieldPath>
            <trigger/>
            <errorString>IdError.NOT_FOUND</errorString>
            <ApiError.Type>IdError</ApiError.Type>
            <reason>NOT_FOUND</reason>
          </errors>
        </ApiExceptionFault>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

I think the generated jobId is not valid.

thx

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@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