Adwords API V2009 CampaignTargetService SOAP error

9 views
Skip to first unread message

NS

unread,
Mar 30, 2010, 5:08:52 PM3/30/10
to AdWords API Forum
Hello Everyone,

I am very new to the adwords API and we are using ruby client library.

I updated the gem adword4r to 18.0.0 version yesterday and tried to
update the geotargetting countries in the campaign and I am getting
following SOAP error.

SOAP Error: Unmarshalling Error: Unable to create an instance of
com.google.ads.api.services.campaignmgmt.campaigntarget.v200909.jaxbgen.GeoTarget
(code: 0)

Any help would be highly appreciated.

Thanks,
NS

AdWords API Advisor

unread,
Mar 31, 2010, 5:29:53 PM3/31/10
to AdWords API Forum
Hi NS,

This error usually means that you are using the base type GeoTarget
directly in your request. You'll need to use a concrete subtype like
ProximityTarget, etc to avoid this error.

Best,
- Eric Koleda, AdWords API Team

NS

unread,
Mar 31, 2010, 5:43:54 PM3/31/10
to AdWords API Forum
Hi Erik,

Thanks for your reply.

My code doesn't look very different than the example posted at
following URL.

http://code.google.com/p/google-api-adwords-ruby/source/browse/trunk/examples/v200909/set_campaign_targets.rb

As mentioned before, I am very new to this development so please bare
with me here.

Also I have posted my code in another thread at the link below.

http://groups.google.com/group/adwords-api/browse_thread/thread/e5867c01ec1b33bf

I really appreciated your help.

Thanks,
NS

On Mar 31, 2:29 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:

> > NS- Hide quoted text -
>
> - Show quoted text -

AdWords API Advisor

unread,
Apr 1, 2010, 10:09:58 AM4/1/10
to AdWords API Forum
Hi NS,

Your code looks correct. Do you have the SOAP XML request and
response that was generated by it?

Best,
- Eric

On Mar 31, 5:43 pm, NS <nishasu...@gmail.com> wrote:
> Hi Erik,
>
> Thanks for your reply.
>
> My code doesn't look very different than the example posted at
> following URL.
>

> http://code.google.com/p/google-api-adwords-ruby/source/browse/trunk/...


>
> As mentioned before, I am very new to this development so please bare
> with me here.
>
> Also I have posted my code in another thread at the link below.
>

> http://groups.google.com/group/adwords-api/browse_thread/thread/e5867...

NS

unread,
Apr 1, 2010, 1:10:05 PM4/1/10
to AdWords API Forum
Hi Erik,

After your yesterday's reply I was trying few things and was checking
my object types and realised that in Ruby arrays are not typed. So I
made following change to the code and it is working fine now.

@campaign_target_srv = @adwords.get_service('CampaignTarget',
latest)


geo_target_list = @campaign_target_srv.module::GeoTargetList.new
geo_target_list.campaignId = @campaign.api_identifier
geo_target_list.targets = []


if @params['geotarget_countries']
@params['geotarget_countries'].each do |country|
geo_target_country =
@campaign_target_srv.module::CountryTarget.new
geo_target_country.excluded = false
geo_target_country.countryCode = country
geo_target_list.targets << geo_target_country
end
end


geo_operation =
@campaign_target_srv.module::CampaignTargetOperation.new
geo_operation.operand = geo_target_list
geo_operation.operator = 'SET'

response = @campaign_target_srv.mutate(geo_operation)

So now I am populating the geo_target_list.targets array directly by
adding CountryTarget object, instead of adding CountryTarget to an
array and assigning an array to gea_target_list.targets.

Hope this helps others.

Thanks,
NS.

On Apr 1, 7:09 am, AdWords API Advisor <adwordsapiadvi...@google.com>

> > > - Show quoted text -- Hide quoted text -

Reply all
Reply to author
Forward
0 new messages