未捕获的SoapFault例外:[客户]功能(“getUserLists”)AdWords API

The following output is returned whenever I try to run the example: AddCrmBasedUserList.php. Other examples like GetAccountHierarchy.php and GetRefreshToken.php works without issue.

The example is partially working. It creates a new user list but it can not get all the user lists. How this could be fixed and is there any way to modify the script to get the user lists without creating a new one.

User list with name 'Customer relationship management list #5b338ddd1c1224' and ID 6117212421 was added.
PHP Fatal error:  Uncaught SoapFault exception: [Client] Function ("getUserLists") is not a valid method for this service in \examples\AddCrmBasedUserList.php:131
Stack trace:
#0 Z:\examples\AddCrmBasedUserList.php(131): SoapClient->__call('getUserLists', Array)
#1 Z:\examples\AddCrmBasedUserList.php(131): Google\AdsApi\AdWords\v201710m\AdwordsUserListService->getUserLists()
#2 Z:\examples\AddCrmBasedUserList.php(151): Google\AdsApi\Examples\AdWords\v201710\Remarketing\AddCrmBasedUserList::runExample(Object(Google\AdsApi\AdWords\AdWordsServices), Object(Google\AdsApi\AdWords\AdWordsSession), Array)
#3 Z:\examples\AddCrmBasedUserList.php(155): Google\AdsApi\Examples\AdWords\v201710\Remarketing\AddCrmBasedUserList::main()
#4 {main}
  thrown in Z:\examples\AddCrmBasedUserList.php on line 131

The code:

<?php
/**
 * Copyright 2017 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace Google\AdsApi\Examples\AdWords\v201710\Remarketing;

require __DIR__ . '/../vendor/autoload.php';

use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSession;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
use Google\AdsApi\AdWords\v201710\cm\Operator;
use Google\AdsApi\AdWords\v201710m\AddressInfo;
use Google\AdsApi\AdWords\v201710m\AdwordsUserListService;
use Google\AdsApi\AdWords\v201710m\CrmBasedUserList;
use Google\AdsApi\AdWords\v201710m\Member;
use Google\AdsApi\AdWords\v201710m\MutateMembersOperand;
use Google\AdsApi\AdWords\v201710m\MutateMembersOperation;
use Google\AdsApi\AdWords\v201710m\UserListOperation;
use Google\AdsApi\Common\OAuth2TokenBuilder;

/**
 * This example adds a user list (a.k.a. audience) and uploads members to
 * populate the list.
 *
 * <p><em>Note:</em> It may take up to several hours for the list to be
 * populated with members.
 * Email addresses must be associated with a Google account.
 * For privacy purposes, the user list size will show as zero until the list has
 * at least 1,000 members. After that, the size will be rounded to the two most
 * significant digits.
 */
class AddCrmBasedUserList
{

    private static $EMAILS = [
        'test@test.com',

    ];

    public static function runExample(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        array $emails
    ) {
        $userListService = $adWordsServices->get($session, AdwordsUserListService::class);

        // Create a CRM based user list.
        $userList = new CrmBasedUserList();
        $userList->setName('Customer relationship management list #' . uniqid());
        $userList->setDescription(
            'A list of customers that originated from email addresses'
        );

        // Maximum life span is 180 days.
        $userList->setMembershipLifeSpan(180);

        // Create a user list operation and add it to the list.
        $operations = [];
        $operation = new UserListOperation();
        $operation->setOperand($userList);
        $operation->setOperator(Operator::ADD);
        $operations[] = $operation;

        // Create the user list on the server and print out some information.
        $userList = $userListService->mutate($operations)->getValue()[0];
        printf(
            "User list with name '%s' and ID %d was added.
",
            $userList->getName(),
            $userList->getId()
        );

        // Create operation to add members to the user list based on email
        // addresses.
        $mutateMembersOperations = [];
        $mutateMembersOperation = new MutateMembersOperation();
        $operand = new MutateMembersOperand();
        $operand->setUserListId($userList->getId());

        $members = [];
        // Hash normalized email addresses based on SHA-256 hashing algorithm.
        foreach ($emails as $email) {
            $memberByEmail = new Member();
            $memberByEmail->setHashedEmail(self::normalizeAndHash($email));
            $members[] = $memberByEmail;
        }

        $firstName = 'test';
        $lastName = 'test';
        $countryCode = 'US';
        $zipCode = '10011';

        $addressInfo = new AddressInfo();
        // First and last name must be normalized and hashed.
        $addressInfo->setHashedFirstName(self::normalizeAndHash($firstName));
        $addressInfo->setHashedLastName(self::normalizeAndHash($lastName));
        // Country code and zip code are sent in plain text.
        $addressInfo->setCountryCode($countryCode);
        $addressInfo->setZipCode($zipCode);

        $memberByAddress = new Member();
        $memberByAddress->setAddressInfo($addressInfo);
        $members[] = $memberByAddress;

        // Add members to the operand and add the operation to the list.
        $operand->setMembersList($members);
        $mutateMembersOperation->setOperand($operand);
        $mutateMembersOperation->setOperator(Operator::ADD);
        $mutateMembersOperations[] = $mutateMembersOperation;

        // Add members to the user list based on email addresses.



        $userListService = $adWordsServices->get($session, AdwordsUserListService::class);

        foreach ($userListService->getUserLists() as $userList) {
            echo $userList->getName();
            echo $userList->getId();
        }
    }


    private static function normalizeAndHash($value)
    {
        return hash('sha256', strtolower(trim($value)));
    }

    public static function main()
    {
        // Generate a refreshable OAuth2 credential for authentication.
        $oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();

        // Construct an API session configured from a properties file and the
        // OAuth2 credentials above.
        $session = (new AdWordsSessionBuilder())->fromFile()->withOAuth2Credential($oAuth2Credential)->build();
        self::runExample(new AdWordsServices(), $session, self::$EMAILS);
    }
}

AddCrmBasedUserList::main();