How to cancel a batch job using BatchJobService

123 views
Skip to first unread message

lz...@marinsoftware.com

unread,
Feb 17, 2016, 4:20:57 AM2/17/16
to AdWords API Forum
Recently we are testing on canceling a batch job, but encountered an issue. We are not sure whether we could cancel a batch job using BatchJobService.

Here is our testing code(scala code): 
// Create a new Batch job
val session = GoogleCredentials.buildSession(accessToken, "########")
val batchJobService = new AdWordsServices().get(session, classOf[BatchJobServiceInterface])
val jobOperation = new BatchJobOperation()
jobOperation.setOperator(Operator.ADD) 
jobOperation.setOperand(new BatchJob())
val batchJobReturnValue = batchJobService.mutate(Array[BatchJobOperation](jobOperation)).getValue(0)

Thread.sleep(2000)

// Remove the above batch job
val removeOperation = new BatchJobOperation()
removeOperation.setOperator(Operator.REMOVE)
val batchJob = new BatchJob()
batchJob.setId(batchJobReturnValue.getId)
removeOperation.setOperand(batchJob)
val batchOpResult = batchJobService.mutate(Array[BatchJobOperation](removeOperation)).getValue(0)
println(batchOpResult.getStatus)

Here is the exception we got with the above code:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201509" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>#######</ns1:clientCustomerId>
            <ns1:developerToken>##########</ns1:developerToken>
            <ns1:userAgent>#######</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
            <operations>
                <operator>REMOVE</operator>
                <operand>
                    <id>1235132</id>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>

16:53:59.816 [testremovebatch-akka.actor.default-dispatcher-4] WARN  c.g.a.a.a.l.c.A.soapXmlLogger - SOAP Response:
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201509">
            <requestId>00052bf3640c99e00abf36819d0be28f</requestId>
            <serviceName>BatchJobService</serviceName>
            <methodName>mutate</methodName>
            <operations>1</operations>
            <responseTime>206</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.&lt;init&gt;(InternalApiErro]</faultstring>
            <detail>
                <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201509">
                    <message>[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.&lt;init&gt;(InternalApiErro]</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="InternalApiError">
                        <fieldPath/>
                        <trigger/>
                        <errorString>InternalApiError.UNEXPECTED_INTERNAL_API_ERROR</errorString>
                        <ApiError.Type>InternalApiError</ApiError.Type>
                        <reason>UNEXPECTED_INTERNAL_API_ERROR</reason>
                    </errors>
                </ApiExceptionFault>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>


Anthony Madrigal

unread,
Feb 17, 2016, 2:06:37 PM2/17/16
to AdWords API Forum
Hello,

This is an issue that our team is aware of. I will keep you updated and let you know when there is a fix for this issue.

Regards,
Anthony
AdWords API Team

Anthony Madrigal

unread,
Mar 8, 2016, 4:28:55 PM3/8/16
to AdWords API Forum
Hello,

This issue has been resolved. Please let me know if you are still running into issues.
Reply all
Reply to author
Forward
0 new messages