minCpc not returned from addCriterion()

1 view
Skip to first unread message

JasonC

unread,
Sep 25, 2006, 3:03:01 PM9/25/06
to AdWords API Forum
When calling CriterionService.addCriterion() with a Keyword-type, the
Keyword-type object that I get back contains a field minCpc.

The field is read-only, so I would expect that it would be set after
calling addCriterion(), but it is not set (using the v5 sandbox).

Is this expected? Or should this value be set?

Richard Jones

unread,
Sep 25, 2006, 3:27:35 PM9/25/06
to JasonC, AdWords API Forum
On Mon, Sep 25, 2006 at 07:03:01PM -0000, JasonC wrote:
> When calling CriterionService.addCriterion() with a Keyword-type, the
> Keyword-type object that I get back contains a field minCpc.
>
> The field is read-only, so I would expect that it would be set after
> calling addCriterion(), but it is not set (using the v5 sandbox).

I don't quite understand what you mean by saying the "field is
read-only" and saying that it's "not set". What is the actual XML
that you're sending and getting back for this keyword?

Rich.

--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!

JasonC

unread,
Sep 25, 2006, 5:26:34 PM9/25/06
to AdWords API Forum
I'm being bitten by the .Net generated web service proxies, I think.

For this WSDL entry (e.g., TrafficEstimatorService.KeywordRequest):

<element name="id" minOccurs="0" maxOccurs="1" type="long" />

I get

private long idField;
private bool idFieldSpecified;

But for this WSDL entry (e.g., CriterionService.Keyword):

<element name="minCpc" nillable="true" minOccurs="0" type="xsd:long"
/>

I get

private System.Nullable<long> minCpcField;
private bool minCpcFieldSpecified;

In the first case, I need to respect and set the idFieldSpecified field
when setting idField, otherwise the soap request does not render out
the corresponding idField.

In the second case, I was expecting similar behavior, so I was looking
to the minCpcFieldSpecified field to see if it was true. In this case,
the minCpcFieldSpecified value was false, even though the minCpcField
was non-null and contained a value (and I was just inspecting the
*Specified field to see if there was a value).

So....

.Net is very specific and literal in generating proxies over WSDL,
leading to some odd client experiences, and Google uses a slightly
different WSDL construct for something that users (at least I) expect
to operate the same (here, an optional long field).

Perhaps nothing to be done here, but it did trip me up for a bit.

Reply all
Reply to author
Forward
0 new messages