Problem with campaignService.getCampaign

8 views
Skip to first unread message

bram withaar

unread,
Mar 6, 2008, 7:52:48 AM3/6/08
to AdWords API Forum
i'm using the java api, and V11 of the api.
The java code throws an error on this line:
thisCampaign = campaignService.getCampaign( id );

id is a valid int, and it is the valid id of one of our campaigns, the
code does a String to int conversion on the line above the failing
one: int id = Integer.valueOf(CURRENT_VALUE).intValue();

The error thrown is:
Error: null
java.lang.NumberFormatException: null
at java.lang.Long.parseLong(Long.java:377)
at java.lang.Long.parseLong(Long.java:466)
at
com.google.api.adwords.lib.ServiceAccountant.setTime(ServiceAccountant.java:
101)
at
com.google.api.adwords.lib.ServiceAccountant.decodeHeaders(ServiceAccountant.java:
69)
at
com.google.api.adwords.v11.CampaignServiceSoapBindingStub.getCampaign_aroundBody7$advice(CampaignServiceSoapBindingStub.java:
132)
at
com.google.api.adwords.v11.CampaignServiceSoapBindingStub.getCampaign(CampaignServiceSoapBindingStub.java:
1)
at nl.kieskeurig.adWords.GoogleAdWords.echo(GoogleAdWords.java:354)

I'm new to this adwords stuff (and to the crashing application), so
i'm a little stunned at the thrown error. Looks like the error is in
the ServiceAccountant, but how do i find out what's going wrong there?

The same code, with the same credentials, ran fine a month ago.

AdWords API Advisor

unread,
Mar 6, 2008, 3:15:05 PM3/6/08
to AdWords API Forum
Hello Bram,

Hmmm, based on the stack trace in the exception, it appears that the
responseTime SOAP header was present in your response but had a value
of null. The client library obviously should handle this gracefully
rather than throwing an exception, and I'll flag it for a fix in the
next release of the library.

In the meantime, though, I'm curious as to why you're getting
responses that have empty responseTime headers all of a sudden. Could
you enable SOAP logging via AdWordsServiceLogger.log() and pass along
the request and response messages illustrating the problem, with any
sensitive password and token information X-ed out?

Cheers,
-Jeffrey Posnick, AdWords API Team

bram withaar

unread,
Mar 12, 2008, 5:50:57 AM3/12/08
to AdWords API Forum
Hello Jefrey,

Thanks for your follow-up. I've been away a couple of days, so a late
response from me.
I've enabled the AdWordsServiceLogger, and added the output (with
credentials X-ed ).
The code still crashes with the same error, so nothing changed ;-(.

Hope to hear from you soon.


12-mrt-2008 10:36:20 org.apache.axis.transport.http.HTTPSender invoke
FINE: Enter: HTTPSender::invoke
12-mrt-2008 10:36:24 org.apache.axis.transport.http.HTTPSender
writeToSocket
FINE: XML sent:
12-mrt-2008 10:36:24 org.apache.axis.transport.http.HTTPSender
writeToSocket
FINE: ---------------------------------------------------
12-mrt-2008 10:36:24 org.apache.axis.transport.http.HTTPSender
writeToSocket
FINE: POST /api/adwords/v11/CampaignService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related,
text/*
User-Agent: Axis/1.2.1
Host: adwords.google.com
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 1396

<?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:email
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns:ns1="https://adwords.google.com/api/
adwords/v11">XXX...@XXX.nl</ns1:email><ns2:password
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns:ns2="https://adwords.google.com/api/
adwords/v11">XXXXX</ns2:password><ns3:developerToken
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns:ns3="https://adwords.google.com/api/
adwords/v11">XXXXX</ns3:developerToken><ns4:applicationToken
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns:ns4="https://adwords.google.com/api/
adwords/v11">XXXX</ns4:applicationToken><ns5:useragent
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns:ns5="https://adwords.google.com/api/
adwords/v11">google java lib 0.11 P@ playing with the API from ruby</
ns5:useragent></soapenv:Header><soapenv:Body><getCampaign
xmlns="https://adwords.google.com/api/adwords/v11"><id>9673440</id></
getCampaign></soapenv:Body></soapenv:Envelope>
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readHeadersFromSocket
FINE: HTTP/1.0 200 OK
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readHeadersFromSocket
FINE: Content-Type text/xml; charset=utf-8
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readHeadersFromSocket
FINE: Expires Wed, 12 Mar 2008 09:36:24 GMT
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readHeadersFromSocket
FINE: Cache-Control private, max-age=0
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readHeadersFromSocket
FINE: Date Wed, 12 Mar 2008 09:36:24 GMT
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readHeadersFromSocket
FINE: Server GFE/1.3
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readHeadersFromSocket
FINE: Connection Close
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readFromSocket
FINE:
no Content-Length
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readFromSocket
FINE:
XML received:
12-mrt-2008 10:36:25 org.apache.axis.transport.http.HTTPSender
readFromSocket
FINE: -----------------------------------------------
12-mrt-2008 10:36:26 org.apache.axis.transport.http.HTTPSender
readFromSocket
FINE: <?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>
<responseTime soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v11">1024</responseTime>
<operations soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v11">1</operations>
<units soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v11">1</units>
<requestId soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v11">8435c7a203a60796a8b5645a0b2e53da</requestId>
</soapenv:Header>
<soapenv:Body>
<getCampaignResponse xmlns="https://adwords.google.com/api/adwords/
v11">
<getCampaignReturn>
<budgetOptimizerSettings>
<enabled>false</enabled>
</budgetOptimizerSettings>
<dailyBudget>2000000000</dailyBudget>
<enableSeparateContentBids>false</enableSeparateContentBids>
<endDay>2008-12-31+01:00</endDay>
<geoTargeting>
<targetAll>false</targetAll>
<countryTargets>
<countries>NL</countries>
</countryTargets>
<regionTargets xsi:nil="true"/>
<metroTargets xsi:nil="true"/>
<cityTargets xsi:nil="true"/>
<proximityTargets xsi:nil="true"/>
</geoTargeting>
<id>9673440</id>
<languageTargeting>
<languages>nl</languages>
</languageTargeting>
<name>API KK Productgroups</name>
<networkTargeting>
<networkTypes>SearchNetwork</networkTypes>
</networkTargeting>
<schedule>
<status>Disabled</status>
</schedule>
<startDay>2006-03-20+01:00</startDay>
<status>Active</status>
</getCampaignReturn>
</getCampaignResponse>
</soapenv:Body>
</soapenv:Envelope>
12-mrt-2008 10:36:26 org.apache.axis.transport.http.HTTPSender invoke
FINE: Exit: HTTPDispatchHandler::invoke

AdWords API Advisor

unread,
Mar 21, 2008, 10:28:14 AM3/21/08
to AdWords API Forum
Hello Bram,

I just wanted to apologize for the delay in getting back to you. We
are in the process of putting together an updated version of the Java
AdWords API client library that will put in specific checks in that
code path to ensure that the values are valid before trying to convert
them to longs. I'll let you know as soon as there is something
available to test.

Cheers,
-Jeff Posnick, AdWords API Team
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><ns1:email
> soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
> soapenv:mustUnderstand="0" xmlns:ns1="https://adwords.google.com/api/
> adwords/v11">XXX....@XXX.nl</ns1:email><ns2:password

AdWords API Advisor

unread,
Apr 9, 2008, 11:46:18 AM4/9/08
to AdWords API Forum
Hello Bram,

An updated version of the Java client library has been released at

http://code.google.com/p/google-api-adwords-java/

It contains some extra exception handling which hopefully should deal
with the error you were seeing. Could you please try upgrading and see
if things are working for you now?

Cheers,
-Jeff Posnick, AdWords API Team


On Mar 21, 10:28 am, AdWords API Advisor
Reply all
Reply to author
Forward
0 new messages