I used adwords batch processing api to create adwords campaign structures. 
When uploading operations using 
BatchJobHelper.uploadIncrementalBatchJobOperations I got error Null 
operation, as bellow :

java.lang.NullPointerException: Null operation
    at 
com.google.common.base.Preconditions.checkNotNull(Preconditions.java:228) 
~[guava-19.0.jar!/:na]
    at 
com.google.api.ads.adwords.axis.utils.v201605.batchjob.BatchJobMutateRequest.addOperation(BatchJobMutateRequest.java:82)
 
~[adwords-axis-2.17.0.jar!/:na]
    at 
com.google.api.ads.adwords.axis.utils.v201605.batchjob.BatchJobMutateRequest.addOperations(BatchJobMutateRequest.java:87)
 
~[adwords-axis-2.17.0.jar!/:na]
    at 
com.google.api.ads.adwords.axis.utils.v201605.batchjob.BatchJobHelperImpl.uploadIncrementalBatchJobOperations(BatchJobHelperImpl.java:85)
 
~[adwords-axis-2.17.0.jar!/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[na:1.7.0_101]
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
~[na:1.7.0_101]
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 
~[na:1.7.0_101]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_101]
    at 
com.google.api.ads.common.lib.utils.AdsUtilityInvocationHandler.handleInvocation(AdsUtilityInvocationHandler.java:46)
 
~[ads-lib-2.17.0.jar!/:na]
    at 
com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87)
 
~[guava-19.0.jar!/:na]
    at com.sun.proxy.$Proxy81.uploadIncrementalBatchJobOperations(Unknown 
Source) ~[na:na]
    at 
com.google.api.ads.adwords.axis.utils.v201605.batchjob.BatchJobHelper.uploadIncrementalBatchJobOperations(BatchJobHelper.java:65)
 
~[adwords-axis-2.17.0.jar!/:na]
    at 
com.kofera.pusher.service.impl.BatchProcessServiceImpl.startBatchProcess(BatchProcessServiceImpl.java:154)
 
~[classes!/:na]
    at 
com.kofera.pusher.service.impl.PushBatchServiceImpl.processTask(PushBatchServiceImpl.java:109)
 
[classes!/:na]
    at 
com.kofera.pusher.service.impl.PushBatchServiceImpl.access$200(PushBatchServiceImpl.java:29)
 
[classes!/:na]
    at 
com.kofera.pusher.service.impl.PushBatchServiceImpl$1.run(PushBatchServiceImpl.java:72)
 
[classes!/:na]
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
[na:1.7.0_101]
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
[na:1.7.0_101]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_101]

I try to upload CampaignOperation and AdGroupOperation separately and its 
succeed. Only when I try to upload AdGroupAdOperation I got the Null 
Operation error again. 

Here the code how i compose the AdGroupAdOperation :

    private AdGroupAdOperation composeAddOperation(Ad obj) {

        // Compose Operand
        TextAd textAd = new TextAd();
        textAd.setHeadline(obj.getH());
        textAd.setDescription1(obj.getD1());
        textAd.setDescription2(obj.getD2());
        textAd.setDisplayUrl(obj.getDu());
        textAd.setFinalUrls(new String[] { obj.getFu() });
        AdGroupAd adGroupAd = new AdGroupAd();
        adGroupAd.setAdGroupId(obj.getAdGroupOrigId());
        adGroupAd.setAd(textAd);

        // Create operation
        AdGroupAdOperation operation = new AdGroupAdOperation();
        operation.setOperand(adGroupAd);
        operation.setOperator(Operator.ADD);

        return operation;
    }

Please let me now if more information is required.

Thanks,
Irfan

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@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/99f67b9d-be5c-46b9-ab6a-85a130feaca1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to