XML SOAP Error Invalid byte 1 of 1-byte UTF-8 sequence

127 views
Skip to first unread message

Adam Jay

unread,
Jun 16, 2020, 9:26:45 AM6/16/20
to AdWords API and Google Ads API Forum
Hi. 
I have some issue withe encoding the XML request to the Ads API ("TargetingIdeaService") 
The request is: 
<?xml version="1.0" encoding="UTF-8"?>
  <env:Header>
    <wsdl:RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
      <clientCustomerId>xxxxxxx</clientCustomerId>
      <userAgent>xxxxxxxxxx</userAgent>
      <developerToken>xxxxxxxx</developerToken>
    </wsdl:RequestHeader>
  </env:Header>
  <env:Body>
      <selector>
        <searchParameters xsi:type="LanguageSearchParameter">
          <languages xmlns:cm="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="cm:Language">
            <cm:id>1000</cm:id>
          </languages>
        </searchParameters>
        <searchParameters xsi:type="LocationSearchParameter">
          <locations xmlns:cm="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="cm:Location">
            <cm:id>2616</cm:id>
          </locations>
        </searchParameters>
        <searchParameters xsi:type="RelatedToQuerySearchParameter">
          <queries>żarowka</queries>
        </searchParameters>
        <ideaType>KEYWORD</ideaType>
        <requestType>STATS</requestType>
        <requestedAttributeTypes>KEYWORD_TEXT</requestedAttributeTypes>
        <requestedAttributeTypes>SEARCH_VOLUME</requestedAttributeTypes>
        <requestedAttributeTypes>COMPETITION</requestedAttributeTypes>
        <requestedAttributeTypes>AVERAGE_CPC</requestedAttributeTypes>
        <requestedAttributeTypes>TARGETED_MONTHLY_SEARCHES</requestedAttributeTypes>
        <requestedAttributeTypes>CATEGORY_PRODUCTS_AND_SERVICES</requestedAttributeTypes>
        <paging xmlns:cm="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="cm:Paging">
          <cm:startIndex>0</cm:startIndex>
          <cm:numberResults>100</cm:numberResults>
        </paging>
      </selector>
    </get>
  </env:Body>
</env:Envelope>

In response i get: 
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>Unmarshalling Error: ParseError at [row,col]:[22,100]
Message: Invalid byte 1 of 1-byte UTF-8 sequence. </faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

I'm am working in R. 

Google Ads API Forum Advisor Prod

unread,
Jun 16, 2020, 4:39:41 PM6/16/20
to a.jon...@gmail.com, adwor...@googlegroups.com
Hi Adam,

The issue you are facing may be due to parsing error with one of your chars. Here is an example of what the request structure should look like. I found this thread that may be able to help you out too.

Regards,
Anthony
Google Ads API Team

ref:_00D1U1174p._5004Q20ZG43:ref

Adam Jay

unread,
Jun 17, 2020, 9:22:20 AM6/17/20
to AdWords API and Google Ads API Forum
The request contains "UTF-8" encoding declaration. 
The problem might be withe the 
          <queries>żarowka</queries>
but this is also in the UTF-8.

Google Ads API Forum Advisor Prod

unread,
Jun 17, 2020, 3:23:10 PM6/17/20
to a.jon...@gmail.com, adwor...@googlegroups.com
Hi Adam,

From the resources I've seen regarding this issue, you may be running issues with how you're reading your XML file. Unfortunately, since this issue is not specifically because of our API, this issue is not within our scope. 
Reply all
Reply to author
Forward
0 new messages