FeedItem service returns invalid characters.

122 views
Skip to first unread message

Caihua Du

unread,
Oct 15, 2017, 1:25:22 PM10/15/17
to AdWords API Forum
Hi there,

We found that when we call FeedItemService, the response contains invalid charters in the xml body. We saw similar issue at the early of this year and AdWords fixed this, it seems we have seen this issue again. Can you please look into this?


Response is not well-formed XML. ---> System.Xml.XmlException: ' ', hexadecimal value 0x03, is an invalid character. Line 1, position 2031.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
   at System.Xml.XmlTextReaderImpl.ParseText()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at Google.Api.Ads.Common.Util.XmlUtilities.CreateDocument(Stream stream)
   at Google.Api.Ads.Common.Util.XmlUtilities.CreateDocument(String contents)
   at Google.Api.Ads.Common.Lib.SoapListenerExtension.CallListeners(SoapMessageDirection direction)
   at Google.Api.Ads.Common.Lib.SoapListenerExtension.ProcessMessage(SoapMessage message)
   at System.Web.Services.Protocols.SoapMessage.RunExtensions(SoapExtension[] extensions, Boolean throwOnException)
   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)
   --- End of inner exception stack trace ---
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at Google.Api.Ads.Common.Lib.AdsSoapClient.MakeApiCall(String methodName, Object[] parameters)

Thanks,
Caihua.

Caihua Du

unread,
Oct 15, 2017, 1:27:20 PM10/15/17
to AdWords API Forum

Vincent Racaza (AdWords API Team)

unread,
Oct 16, 2017, 12:23:35 AM10/16/17
to AdWords API Forum
Hi Caihua,

Could you confirm if this latest issue is targeting the clientCustomerId same as your old forum thread? If so, then can you provide the latest SOAP request and response logs so we can further check? Kindly use the Reply privately to author option.

Thanks,
Vincent
AdWords API Team

Vincent Racaza (AdWords API Team)

unread,
Oct 20, 2017, 2:40:07 AM10/20/17
to AdWords API Forum
Hi Caihua,

A gentle follow up on this. If you still have issues regarding this, then kindly provide the details that I asked on my previous reply.

Caihua Du

unread,
Oct 21, 2017, 6:48:44 PM10/21/17
to AdWords API Forum
Sorry for the late response Vincent. I haven't seen this issue shows up again lately. I will let you know if see the same issue again. 

Thanks,
Caihua.

Caihua Du

unread,
Dec 5, 2017, 11:30:47 PM12/5/17
to AdWords API Forum
Hi there,

This issues shows up again, we have at least two customers that have encountered this issue. Here is the latest call stack of this exception. Please let me know if you need the request id for further investigation:


System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.

Server stack trace: 
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at Google.Api.Ads.Common.Util.XmlUtilities.CreateDocument(Stream stream)
   at Google.Api.Ads.Common.Util.XmlUtilities.CreateDocument(String contents)
   at Google.Api.Ads.Common.Logging.TraceListener.PopulateResponseInfo(ResponseInfo& info)
   at Google.Api.Ads.Common.Logging.TraceListener.PerformLogging(RequestInfo request, ResponseInfo response)
   at Google.Api.Ads.Common.Lib.AdsUser.CallListeners(RequestInfo request, ResponseInfo response)
   at Google.Api.Ads.Common.Logging.SoapListenerInspector.AfterReceiveReply(Message& response, Object correlationState)
   at System.ServiceModel.Dispatcher.ImmutableClientRuntime.AfterReceiveReply(ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Google.Api.Ads.AdWords.v201705.FeedItemServiceInterface.get(Selector selector)

Vincent Racaza (AdWords API Team)

unread,
Dec 6, 2017, 3:52:07 AM12/6/17
to AdWords API Forum
Hi Caihua,

Could you provide the SOAP request and response logs instead with the clientCustomerId so I can investigate further? To get all the success and failed SOAP request and response, you can change all the INFO level to DEBUG in the log4j.properties file (in Java). If you are using other client libraries, you can also do the same in their log property file. Please use the Reply privately to author option when replying.

Caihua Du

unread,
Dec 7, 2017, 12:52:29 PM12/7/17
to AdWords API Forum
Hi Vincent,

I haven sent you the SOAP requestID privately, can you please take a look? We have two new instance of this failure again today. Thank you very much!

Josh Radcliff (AdWords API Team)

unread,
Dec 7, 2017, 2:29:26 PM12/7/17
to AdWords API Forum
Hi,

The reason that error is being thrown is that the underlying data in (at least) one particular feed item is invalid. Specifically, the string value for attribute ID 3 in feed ID 23642780/feed item ID 957498860 contains unicode character 031. If you update that feed item through the UI or the AdWords API so it contains valid characters, you should be all set.

Thanks,
Josh, AdWords API Team

Caihua Du

unread,
Dec 8, 2017, 3:37:19 PM12/8/17
to AdWords API Forum
Thank you Josh for looking into it. Is that possible we skip sending the invalid character to the response or we convert to some encoded format? We had similar issue last year from AdWords and I believe the solved it early this year. Not sure if we can use the same pattern here. 

Josh Radcliff (AdWords API Team)

unread,
Dec 8, 2017, 4:53:09 PM12/8/17
to AdWords API Forum
Hi,

You could exclude the problematic feed item ID(s) via a FeedItemId NOT_IN [..., ..., ...] predicate. That would allow you to retrieve all of the other feed items in your feeds. To fix the problematic feed items, you can update or remove them via the AdWords user interface or through a FeedItemService.mutate request.

Note that when I've seen data like this in the past, it's been due to users somehow adding the invalid values outside of the AdWords API (for example, through AdWords Editor, Bulk uploads, or the AdWords user interface). I don't foresee us adding special encoding rules to the AdWords API for these cases, since that would mean all clients would have to understand how to interpret those rules.

Thanks,
Josh, AdWords API Team

Caihua Du

unread,
Dec 8, 2017, 7:06:36 PM12/8/17
to AdWords API Forum
Got it. In our case, customer is using our tool to get FeedItem data, and we are not able to modify the invalid data for them without their permission and hence mutate operation may not be an option for us. It seems to me there is no other way to fix unless customer update their data specifically. 

Josh Radcliff (AdWords API Team)

unread,
Dec 12, 2017, 9:06:12 AM12/12/17
to AdWords API Forum
Hi,

Yes, I think that's the best approach. If they export their feed items to a CSV, it should be pretty easy to see the unprintable characters, and then they can fix those through the user interface.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages