title: Adding Proximity target in AdWords API gives CampaignCriterionError.CONCRETE_TYPE_REQUIRED
body: <p><em>Edit: Google has confirmed this is a bug in the client libraries: <a href="https://github.com/googleads/googleads-java-lib/issues/20_" rel="nofollow">https://github.com/googleads/googleads-java-lib/issues/20</em></a></p>
  
  <p>I am trying to add a Proximity targeting criterion to a campaign using the AdWords API. I am using the JAX-WS version of the API (because I need it to run on App Engine). I am able to add Proximity criteria with the AXIS version of the API, so I'm wondering if there is a bug in the API.</p>
  
  <p>This is the code I'm using to add the Proximity criterion:</p>
  
  <pre><code>    // Get the CampaignService.
  CampaignCriterionServiceInterface campaignCriterionService =
      adWordsServices.get(session, CampaignCriterionServiceInterface.class);
  
  Proximity proximity = new Proximity();
  GeoPoint geoPoint = new GeoPoint();
  geoPoint.setLatitudeInMicroDegrees(43633941);
  geoPoint.setLongitudeInMicroDegrees(-79398718);
  proximity.setGeoPoint(geoPoint);
  proximity.setRadiusDistanceUnits(ProximityDistanceUnits.KILOMETERS);
  proximity.setRadiusInUnits(10.0);
  
  List&lt;CampaignCriterionOperation&gt; operations = new ArrayList&lt;CampaignCriterionOperation&gt;();
  for (Criterion criterion : new Criterion[] { proximity }) {
    CampaignCriterionOperation operation = new CampaignCriterionOperation();
    CampaignCriterion campaignCriterion = new CampaignCriterion();
    campaignCriterion.setCampaignId(campaignId);
    campaignCriterion.setCriterion(criterion);
    operation.setOperand(campaignCriterion);
    operation.setOperator(Operator.ADD);
    operations.add(operation);
  }
  
  CampaignCriterionReturnValue result =
      campaignCriterionService.mutate(operations);
  
  // Display campaigns.
  for (CampaignCriterion campaignCriterion : result.getValue()) {
    System.out.printf("Campaign criterion with campaign id '%s', criterion id '%s', "
        + "and type '%s' was added.\n", campaignCriterion.getCampaignId(), campaignCriterion
        .getCriterion().getId(), campaignCriterion.getCriterion().getCriterionType());
  }
  </code></pre>
  
  <p>This is basically the code from <a href="https://github.com/googleads/googleads-java-lib/blob/master/examples/adwords_axis/src/main/java/adwords/axis/v201402/targeting/AddCampaignTargetingCriteria.java" rel="nofollow">https://github.com/googleads/googleads-java-lib/blob/master/examples/adwords_axis/src/main/java/adwords/axis/v201402/targeting/AddCampaignTargetingCriteria.java</a> where criteria have been replaced by a Proximity criterion and with classes from com.google.api.ads.adwords.axis.* replaced by their com.google.api.ads.adwords.jaxws.* equivalents.</p>
  
  <p>When run (with the appropriate information ads.properties), I get the following error:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;soap:Header&gt;
          &lt;ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201402"&gt;
              &lt;requestId&gt;0004fd8ef85c5a600aec338ad0007a98&lt;/requestId&gt;
              &lt;serviceName&gt;CampaignCriterionService&lt;/serviceName&gt;
              &lt;methodName&gt;mutate&lt;/methodName&gt;
              &lt;operations&gt;1&lt;/operations&gt;
              &lt;responseTime&gt;363&lt;/responseTime&gt;
          &lt;/ResponseHeader&gt;
      &lt;/soap:Header&gt;
      &lt;soap:Body&gt;
          &lt;soap:Fault&gt;
              &lt;faultcode&gt;soap:Server&lt;/faultcode&gt;
              &lt;faultstring&gt;[CampaignCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand.criterion]&lt;/faultstring&gt;
              &lt;detail&gt;
                  &lt;ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201402"&gt;
                      &lt;message&gt;[CampaignCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand.criterion]&lt;/message&gt;
                      &lt;ApplicationException.Type&gt;ApiException&lt;/ApplicationException.Type&gt;
                      &lt;errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CampaignCriterionError"&gt;
                          &lt;fieldPath&gt;operations[0].operand.criterion&lt;/fieldPath&gt;
                          &lt;trigger/&gt;
                          &lt;errorString&gt;CampaignCriterionError.CONCRETE_TYPE_REQUIRED&lt;/errorString&gt;
                          &lt;ApiError.Type&gt;CampaignCriterionError&lt;/ApiError.Type&gt;
                          &lt;reason&gt;CONCRETE_TYPE_REQUIRED&lt;/reason&gt;
                      &lt;/errors&gt;
                  &lt;/ApiExceptionFault&gt;
              &lt;/detail&gt;
          &lt;/soap:Fault&gt;
      &lt;/soap:Body&gt; &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>I suspect that something is going wrong when composing the xml that is sent to AdWords, because the outgoing request looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;S:Header&gt;
          &lt;RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201402"&gt;
              &lt;userAgent&gt;Test (AwApi-Java, AdWords-AppEngine/1.28.0, Common-Java/1.28.0, JAX-WS/Unknown, Java/1.7.0_45, maven)&lt;/userAgent&gt;
              &lt;developerToken&gt;REMOVEDFORSAFETYREASONS&lt;/developerToken&gt;
              &lt;clientCustomerId&gt;XYZ-XYZ-XYYZ&lt;/clientCustomerId&gt;
          &lt;/RequestHeader&gt;
      &lt;/S:Header&gt;
      &lt;S:Body&gt;
          &lt;mutate xmlns="https://adwords.google.com/api/adwords/cm/v201402" xmlns:ns2="https://adwords.google.com/api/adwords/video/v201402"&gt;
              &lt;operations&gt;
                  &lt;operator&gt;ADD&lt;/operator&gt;
                  &lt;operand&gt;
                      &lt;campaignId&gt;185385127&lt;/campaignId&gt;
                      &lt;criterion/&gt;
                  &lt;/operand&gt;
              &lt;/operations&gt;
          &lt;/mutate&gt;
      &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>Notice that the criterion tag is completely empty.</p>
  
  <p>Running the same code, but with the AXIS version of the API works and produces the following  outgoing xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;soapenv:Header&gt;
          &lt;ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201402" soapenv:mustUnderstand="0"&gt;
              &lt;ns1:clientCustomerId&gt;XYZ-XYZ-XYYZ&lt;/ns1:clientCustomerId&gt;
              &lt;ns1:developerToken&gt;REMOVEDFORSAFETY&lt;/ns1:developerToken&gt;
              &lt;ns1:userAgent&gt;Test (AwApi-Java, AdWords-Axis/1.28.0, Common-Java/1.28.0, Axis/1.4, Java/1.7.0_45, jars)&lt;/ns1:userAgent&gt;
              &lt;ns1:validateOnly&gt;false&lt;/ns1:validateOnly&gt;
              &lt;ns1:partialFailure&gt;false&lt;/ns1:partialFailure&gt;
          &lt;/ns1:RequestHeader&gt;
      &lt;/soapenv:Header&gt;
      &lt;soapenv:Body&gt;
          &lt;mutate xmlns="https://adwords.google.com/api/adwords/cm/v201402"&gt;
              &lt;operations&gt;
                  &lt;operator&gt;ADD&lt;/operator&gt;
                  &lt;operand&gt;
                      &lt;campaignId&gt;185385127&lt;/campaignId&gt;
                      &lt;criterion xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201402" xsi:type="ns2:Proximity"&gt;
                          &lt;ns2:geoPoint&gt;
                              &lt;ns2:latitudeInMicroDegrees&gt;43633941&lt;/ns2:latitudeInMicroDegrees&gt;
                              &lt;ns2:longitudeInMicroDegrees&gt;-79398718&lt;/ns2:longitudeInMicroDegrees&gt;
                          &lt;/ns2:geoPoint&gt;
                          &lt;ns2:radiusDistanceUnits&gt;KILOMETERS&lt;/ns2:radiusDistanceUnits&gt;
                          &lt;ns2:radiusInUnits&gt;10.0&lt;/ns2:radiusInUnits&gt;
                      &lt;/criterion&gt;
                  &lt;/operand&gt;
              &lt;/operations&gt;
          &lt;/mutate&gt;
      &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>Notice that in the latter case, the criterion includes the geolocation and radius as one would expect.</p>
  
  <p>Other types of criteria, like Location and Language work fine both in the AXIS and JAX-WS versions.</p>
  
  <p>Has anyone run into this issue before? Any suggestions what could be wrong?</p>