GetCampaign returns "There is an error in XML document"

265 views
Skip to first unread message

Pete

unread,
Sep 9, 2005, 7:18:00 AM9/9/05
to AdWords API Forum
I'm using a vb.net application to make AdWords API calls and I've
recently been getting errors when calling getCampaign(id).

The error does not occur on every campaign (even within the same
account), so I can get some but not all of the campaigns in any
account.

The affected campaigns consistently fail and I've tried changing one of
these via the AdWords Web Interface (which works fine) so that it's
attributes are set exactly the same as another (API accessible)
campaign within the same account. It was still throwing an error.

Any ideas?


Error Msg
"There is an error in XML document (1, 1163)."

Error Stack
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle) at
system.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)

Pete

unread,
Sep 9, 2005, 7:46:03 AM9/9/05
to AdWords API Forum
I've tried Updating the Campaign Web Service as well as removing and
adding the it from my project. Neither made any difference.

MNet

unread,
Sep 9, 2005, 8:29:03 AM9/9/05
to AdWords API Forum

Hi Pete,
I have the same problem with my c# client.
As far as I could trace down the problem only campaigns containing
negative Keywords are causing the error. It's just a guess but I think
.net can't handle the <maxCpc xsi:nil="true"/> tag. It should be
deserialized as null but an System.FormatException: Input string was
not in a correct format. at System.Number.ParseInt64(String s,
NumberStyles style, NumberFormatInfo info) exception is thrown.

Martin

Pete

unread,
Sep 9, 2005, 8:42:08 AM9/9/05
to AdWords API Forum
Hi Martin

You're dead right, there's a thread on the dotnet.framework forum and
an MS emplyee posted this

******************
In general, it is not yet valid to pass nill XML values for value
types.
It is supported to supress serialization of properties using the
Specified
pattern, as you have uncovered.

The construct <xs:element name="foo" nillable="true" type="xs:int" />
is
not supported in the framework. The right way to encode this schema
for
cross platform compatibility is <xs:element name="foo" minOccurs="0"
type="xs:int"/>. What this means is that the parameter is _optional_,
but
not _nillable_.
**********

Not sure where that leaves us though?

MNet

unread,
Sep 9, 2005, 10:44:27 AM9/9/05
to AdWords API Forum
Hi Pete,
I don't think google is going to revoke the changes.
Thank God this problem is fixed in c# 2.0 !

But for now I'm using the nullable classes from
http://nullabletypes.sourceforge.net/.

good luck,

Martin

Pete

unread,
Sep 12, 2005, 6:18:27 AM9/12/05
to AdWords API Forum
Nice one mate - thanks for that; got it all working again using the
nullable classes you suggested.

Cheers

Pete

Kostas

unread,
Sep 12, 2005, 9:34:16 AM9/12/05
to AdWords API Forum
Another workaround would be to just remove the maxCpc attribute from
the generated Keyword class in the Reference.vb/Reference.cs file.

Negative keywords don't have a maxCpc so you won't miss it.

Patrick Chanezon

unread,
Sep 13, 2005, 10:43:43 AM9/13/05
to MNet, AdWords API Forum
On 9/9/05, MNet <Mar...@amalien45.de> wrote:

Hi Pete,
I don't think google is going to revoke the changes.

Not revoke the WSDL changes, but change the behavior of our server to not send these fields that break your toolkit:-)
http://adwordsapi.blogspot.com/2005/09/solving-issue-for-clients-using-net.html

Thank God this problem is fixed in c# 2.0  !

But for now I'm using the nullable classes from
http://nullabletypes.sourceforge.net/.

good luck,

Thanks very much to you and Pete for sharing the analysis of the issue and the interim solution with the community.

P@

Martin




--
Patrick Chanezon, AdWords API evangelist
http://blog.chanezon.com/
http://www.google.com/apis/adwords/

MNet

unread,
Sep 13, 2005, 11:44:28 AM9/13/05
to AdWords API Forum
Hi Patrick,

I'm taking it for granted to share my analysis and solutions with other
developers and I'm glad that Google honours that efforts.
Although the AdwordsAPI is still declared beta I would really
appreciate Google to announce changes in advance
and give us the chance to identify possible problems.
Furthermore I consider it best to retain the approach of versioning
instead of changing an existing version
with "small" changes too which gives us and you the possibility to
implement changes and test them without endangering our live systems.

Regards,

Martin

Reply all
Reply to author
Forward
0 new messages