googleads / google-api-ads-ruby

Ad Manager SOAP API Client Libraries for Ruby
297 stars 229 forks source link

Got "Unable to parse response body" from Ruby ad manager api #174

Closed robinw777 closed 4 years ago

robinw777 commented 4 years ago

According to Ad Manager API team: "After checking the SOAP response body that you've provided, it seems that this should be a valid response by the Ad Manager API's standards." https://groups.google.com/g/google-doubleclick-for-publishers-api/c/dWscHRJaggg

The code below is the minimal repro I can find:

API_VERSION = :v202002
ad_manager = AdManagerApi::Api.new( NETWORK_CONFIG )
cms_metadata_service = ad_manager.service(:CmsMetadataService, API_VERSION)
cms_metadata_service.get_cms_metadata_values_by_statement({:query=>"WHERE id IN (8773782800)"})

GoogleAdsSavon::SOAP::InvalidResponseError (Unable to parse response body '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v202002"><requestId>34b3220d38027919dac62ddab3e3f4bb</requestId><responseTime>143</responseTime></ResponseHeader></soap:Header><soap:Body><getCmsMetadataValuesByStatementResponse xmlns="https://www.google.com/apis/ads/publisher/v202002"><rval><totalResultSetSize>1</totalResultSetSize><startIndex>0</startIndex><results><cmsMetadataValueId>8773782800</cmsMetadataValueId><valueName>manifesation</valueName><key><id>34633</id><name>tag</name></key></results></rval></getCmsMetadataValuesByStatementResponse></soap:Body></soap:Envelope>')
robinw777 commented 4 years ago

note that it's just for this CmsMetadadataValue, others seems fine, so it should be a data dependent issue

robinw777 commented 4 years ago

actually upon further inspection, the response body contains illegal chars in xml 1.0: '\u0014'

<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Header><ResponseHeader xmlns=\"https://www.google.com/apis/ads/publisher/v202002\"><requestId>7af164ca8f483649507f21dde3a2d165</requestId><responseTime>109</responseTime></ResponseHeader></soap:Header><soap:Body><getCmsMetadataValuesByStatementResponse xmlns=\"https://www.google.com/apis/ads/publisher/v202002\"><rval><totalResultSetSize>1</totalResultSetSize><startIndex>0</startIndex><results><cmsMetadataValueId>8773782800</cmsMetadataValueId><valueName>manifes\u0014ation</valueName><key><id>34633</id><name>tag</name></key></results></rval></getCmsMetadataValuesByStatementResponse></soap:Body></soap:Envelope>
robinw777 commented 4 years ago

I'll take this to the api team instead