LocationSearchParams not work

22 views
Skip to first unread message

李谷歌

unread,
Jun 28, 2021, 4:10:22 AM6/28/21
to AdWords API and Google Ads API Forum
Hi ,
  I tried to set LocationSearchParameter in targetingIdeaService, but unfortunately an error occurred and I don't know how to solve it.
Error: Exception'SoapFault' with message'Unmarshalling Error: cvc-type.2: The type definition cannot be abstract for element ns1:searchParameters.
soap:
<?xml version="1.0" encoding="utf-8"?>

  <SOAP-ENV:Header>
    <ns1:RequestHeader>
      <ns2:clientCustomerId>917-615-4256</ns2:clientCustomerId>
      <ns2:developerToken>REDACTED</ns2:developerToken>
      <ns2:userAgent>unknown (AwApi-PHP, googleads-php-lib/40.0.0, PHP/5.6.40)</ns2:userAgent>
      <ns2:validateOnly>false</ns2:validateOnly>
      <ns2:partialFailure>false</ns2:partialFailure>
    </ns1:RequestHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:get>
      <ns1:selector>
        <ns1:searchParameters xsi:type="ns1:RelatedToQuerySearchParameter">
          <ns1:queries>Call of Duty</ns1:queries>
          <ns1:queries>Mobile</ns1:queries>
        </ns1:searchParameters>
        <ns1:searchParameters xsi:type="ns1:LanguageSearchParameter">
          <ns1:languages>
            <ns2:id>1000</ns2:id>
          </ns1:languages>
        </ns1:searchParameters>
        <ns1:searchParameters/>
        <ns1:searchParameters xsi:type="ns1:NetworkSearchParameter">
          <ns1:networkSetting>
            <ns2:targetGoogleSearch>true</ns2:targetGoogleSearch>
            <ns2:targetSearchNetwork>false</ns2:targetSearchNetwork>
            <ns2:targetContentNetwork>false</ns2:targetContentNetwork>
            <ns2:targetPartnerSearchNetwork>false</ns2:targetPartnerSearchNetwork>
          </ns1:networkSetting>
        </ns1:searchParameters>
        <ns1:ideaType>KEYWORD</ns1:ideaType>
        <ns1:requestType>STATS</ns1:requestType>
        <ns1:requestedAttributeTypes>KEYWORD_TEXT</ns1:requestedAttributeTypes>
        <ns1:requestedAttributeTypes>SEARCH_VOLUME</ns1:requestedAttributeTypes>
        <ns1:requestedAttributeTypes>AVERAGE_CPC</ns1:requestedAttributeTypes>
        <ns1:requestedAttributeTypes>COMPETITION</ns1:requestedAttributeTypes>
        <ns1:requestedAttributeTypes>CATEGORY_PRODUCTS_AND_SERVICES</ns1:requestedAttributeTypes>
        <ns1:requestedAttributeTypes>EXTRACTED_FROM_WEBPAGE</ns1:requestedAttributeTypes>
        <ns1:requestedAttributeTypes>TARGETED_MONTHLY_SEARCHES</ns1:requestedAttributeTypes>
        <ns1:paging>
          <ns2:startIndex>0</ns2:startIndex>
          <ns2:numberResults>500</ns2:numberResults>
        </ns1:paging>
      </ns1:selector>
    </ns1:get>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
code:
        $locationParameter = new \Google\AdsApi\AdWords\v201806\o\LocationSearchParameter();
        $location = new \Google\AdsApi\AdWords\v201809\cm\Location();
        $location->setId(2643);
        $locationParameter->setLocations([$location]);
        $searchParameters[] = $locationParameter;
thank you for your help!
Reply all
Reply to author
Forward
0 new messages