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
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
Thanks for your reply.
My code doesn't look very different than the example posted at
following URL.
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 -
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...
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 -