EBay API SOAP错误 - Headers “X-EBAY-API-APP-NAME”不存在 - PHP

我使用PHP SOAP库来调用GetTokenStatus API . 我总是收到SOAP错误消息'Header'X-EBAY-API-APP-NAME“不存在”在这里和其他网站上搜索之后,我出现了以下代码:

$apiCall = 'GetTokenStatus';
$context = array('http' => array('header'  => "X-EBAY-API-APP-NAME: $appId\r\n"));
$soap_options = array(
    'stream_context' => stream_context_create($context),
    'trace' => 1,
    'exceptions' => false,
    'location' => $ApiSite . '/wsapi?callname=' . $apiCall . '&appid=' . $appId . '&siteid=' . $SiteID. '&version=821&routing=new'
);

$client = new SOAPClient($wsdl_url, $soap_options);
$requesterCredentials = new stdClass();
$requesterCredentials->eBayAuthToken = $token;
$header = new SoapHeader('urn:ebay:apis:eBLBaseComponents', 'RequesterCredentials', $requesterCredentials);

$params = array('Version' => 821);

$responseObj = $client->__soapCall($apiCall, array($params), null, $header);

当我尝试时,答案总是我在主题中写的SOAP错误字符串 . 如果有帮助我可以发回$ responseObj返回 . 我一直在尝试其他解决方案,但我的想法已经用完了 .

回答(0)