XmlException / InvalidOperationException Issue

159 views
Skip to first unread message

testa...@geeks.ltd.uk

unread,
Sep 19, 2014, 10:39:11 AM9/19/14
to adwor...@googlegroups.com

Hi All,

 

I am trying to use the AdWords API to upload some images stored locally on my computer to AdWords, but whenever I try, I keep on getting this same error message:

 

An exception of type 'System.Xml.XmlException' occurred in System.Xml.dll but was not handled in user code

Additional information: Data at the root level is invalid. Line 1, position 1.

 

It occurs at this line

 

adGroupService.mutate(operations.ToArray());

 

where

 

operations = new List<AdGroupOperation>();

 

When this moves into the catch block though, which catches just a general Exception, it says InvalidOperationException, response is not well formed XML, as well as data at root level...

 

I can't figure out what the issue is. I was originally working from a web.config file, which was functioning fine for other purposes. I have run this through an XML validator, and no errors have been found. I tried adding an App.config file as well, as that was also mentioned on the AdWords site, and I read that this error could come from not being able to find the correct file, but I still had the same problem.

 

Does anyone have any suggestions? It would be fantastic if it would tell me what file this error is supposedly in but I don't know how to get that information.

 

Thanks,

Conor

Anash P. Oommen (AdWords API Team)

unread,
Sep 22, 2014, 11:14:31 AM9/22/14
to adwor...@googlegroups.com
Hi Conor,

One common reason for this error is that you don't have the maximumErrorResponseLength key in your App.config. By default, .NET framework truncates an error response to 64K, which is bad, if the response is an xml - you'd end up with a malformed xml. Soap error responses > 64K is common in AdWords API.

Cheers,
Anash P. Oommen,
AdWords API Advisor.
Reply all
Reply to author
Forward
0 new messages