LocationExtensionOperand with GeoTargetOperand causing connection to hang up.

89 views
Skip to first unread message

Edward Grave

unread,
Mar 31, 2015, 5:36:22 AM3/31/15
to adwor...@googlegroups.com
I've been having a bit of difficulty with the new LocationExtensionOperand.

I want to be able to meet the requirement C.21 Set distance targeting.

My C# code looks like this:
var locationCriterion = new LocationGroups {
     matchingFunction
= new Function
                       
{
                            operatorSpecified
= true,
                           
@operator = FunctionOperator.AND,
                            lhsOperand
= new FunctionArgumentOperand[]
                           
{      
                               
new LocationExtensionOperand
                               
{                                    
                                    radius
= new ConstantOperand
                                   
{
                                        typeSpecified
= true,
                                        type
= ConstantOperandConstantType.LONG,
                                        unitSpecified
= true,
                                        unit
= ConstantOperandUnit.MILES,
                                        longValueSpecified
= true,
                                        longValue
= distance                                        
                                   
}
                               
},
                               
                           
},
                            rhsOperand
= new FunctionArgumentOperand[] {
                               
new GeoTargetOperand
                               
{                                    
                                    locations
= new long[123456789]
                               
}
                           
}
                       
}

                   
};

When I send the request through I get the "The request was aborted: The connection was closed unexpectedly."

Can anyone see something obvious that is wrong with this Criterion? The remainder of the code works perfectly with other Criterions.

Having a few issues getting the actual SOAP request but will try and get it if I need to.

Danial Klimkin

unread,
Mar 31, 2015, 11:59:12 AM3/31/15
to adwor...@googlegroups.com
Hello Edward,


The error message is not directly related to the type of the operation you are performing. Do you see the same error for other requests?

Also, see this library example:



-Danial, AdWords API Team.

Edward Grave

unread,
Apr 1, 2015, 4:12:55 AM4/1/15
to adwor...@googlegroups.com
Hi Danial,

I do not get this response back from any other request. We're doing quite a few different types of requests with lots of different Adwords services and none of them are returning this sort of response.

I used the example as a base to code against in the first place and as far as I can tell it matches.

My only concern with the examples is that they never set the '(variable X)Specified' property which is required in most requests to the API. It also states in the documentation that when using the 'AND' operator 'All the operands must be in lhsOperand.' which the example does not do.

Either way I am curious as to why my request is causing the API to hang up the connection so abruptly.

Edward Grave

unread,
Apr 9, 2015, 11:32:59 AM4/9/15
to adwor...@googlegroups.com
I am now getting this response having resolved the connection issue:

Request:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201502">
      <clientCustomerId>MyCustID</clientCustomerId>
      <developerToken>MyDevToken</developerToken>
      <userAgent>MyAgent</userAgent>
    </RequestHeader>
  </soap:Header>
  <soap:Body>
    <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201502">
      <operations>
        <operator>ADD</operator>
        <operand>
          <campaignId>293088684</campaignId>
          <criterion xsi:type="LocationGroups">
            <matchingFunction>
              <operator>AND</operator>
              <lhsOperand xsi:type="LocationExtensionOperand">
                <radius>
                  <type>LONG</type>
                  <unit>MILES</unit>
                  <longValue>20</longValue>
                </radius>
              </lhsOperand>
              <rhsOperand xsi:type="GeoTargetOperand">
                <locations>2826</locations>
              </rhsOperand>
            </matchingFunction>
          </criterion>
        </operand>
      </operations>
    </mutate>
  </soap:Body>
</soap:Envelope>
 
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201502">
      <requestId>0005134c51aac2c80ac45d8a000042bb</requestId>
      <serviceName>CampaignCriterionService</serviceName>
      <methodName>mutate</methodName>
      <operations>0</operations>
      <responseTime>249</responseTime>
    </ResponseHeader>
  </soap:Header>
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>[FunctionError.INVALID_OPERATOR @ operations[0].operand.criterion.matchingFunction, FunctionError.INVALID_NUMBER_OF_OPERANDS @ operations[0].operand.criterion.matchingFunction.rhsOperand]</faultstring>
      <detail>
        <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201502">
          <message>[FunctionError.INVALID_OPERATOR @ operations[0].operand.criterion.matchingFunction, FunctionError.INVALID_NUMBER_OF_OPERANDS @ operations[0].operand.criterion.matchingFunction.rhsOperand]</message>
          <ApplicationException.Type>ApiException</ApplicationException.Type>
          <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="FunctionError">
            <fieldPath>operations[0].operand.criterion.matchingFunction</fieldPath>
            <trigger></trigger>
            <errorString>FunctionError.INVALID_OPERATOR</errorString>
            <ApiError.Type>FunctionError</ApiError.Type>
            <reason>INVALID_OPERATOR</reason>
          </errors>
          <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="FunctionError">
            <fieldPath>operations[0].operand.criterion.matchingFunction.rhsOperand</fieldPath>
            <trigger></trigger>
            <errorString>FunctionError.INVALID_NUMBER_OF_OPERANDS</errorString>
            <ApiError.Type>FunctionError</ApiError.Type>
            <reason>INVALID_NUMBER_OF_OPERANDS</reason>
          </errors>
        </ApiExceptionFault>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

Josh Radcliff (AdWords API Team)

unread,
Apr 9, 2015, 4:41:03 PM4/9/15
to adwor...@googlegroups.com
Hi,

The API does not support targeting a proximity around your location extensions with an additional limitation on the location. The only location extension-related targeting that's supported is to target a proximity around your location extensions with no additional limitations. See lines 133-145 of our AddCampaignTargetingCriteria example.

Thanks,
Josh, AdWords API Team

Edward Grave

unread,
Apr 10, 2015, 4:28:20 AM4/10/15
to adwor...@googlegroups.com
So you are unable to reproduce the targeting of different locations with different radius in the API like you can in the Adwords UI. See the attached screenshot.

From what you are saying you have to create all the different locations and then apply the proximity targeting to them all.
Location Targeting.PNG

Josh Radcliff (AdWords API Team)

unread,
Apr 10, 2015, 10:54:08 AM4/10/15
to adwor...@googlegroups.com
Hi,

Sorry, that's not quite what I meant. There are (at least) three different proximity/radius targeting options in the UI:
  1. Targeting a radius around a specific GeoPoint. You can do this in the API by adding a Proximity criterion to your campaign.
  2. Targeting a radius around all of your location extension locations. You can do this in the API by adding a LocationGroups criterion with a LocationExtensionOperand. You can see an example of this in the AddCampaignTargetingCriteria.java example.
  3. Targeting a radius around all of your location extension locations that are in a specific area. You cannot do this via the API at this time.
Cheers,
Josh, AdWords API Team
Message has been deleted

Edward Grave

unread,
Apr 10, 2015, 12:21:02 PM4/10/15
to adwor...@googlegroups.com
Hi Josh,

Thank you very much for the clear ressponse.

I am now able to progress with my work.

Regards, Ed
Reply all
Reply to author
Forward
0 new messages