Как подключиться к API eBay Trading через SoapClient?
я пытаюсь подключиться к eBay Trading API и сделать базовый запрос с помощью PHP 'класс SoapClient, но яУ меня проблемы. Я'я потратил часы на поиск и возня с примерами, но я не могу заставить что-либо работать. Итак, я написал следующий код Barebones и яЯ пытаюсь заставить его работать:
$token = [token here];
$client = new SOAPClient('http://developer.ebay.com/webservices/latest/eBaySvc.wsdl', array('trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
$header = new SoapHeader('urn:ebay:apis:eBLBaseComponents', 'RequesterCredentials', new SoapVar(array('ebayAuthToken' => $token), SOAP_ENC_OBJECT), false);
$client->__setSoapHeaders(array($header));
$method = 'GeteBayOfficialTime';
$parameters = array(
);
try {
$responseObj = $client->__soapCall($method, array($parameters));
}
catch (Exception $e)
{
echo 'Exception caught. Here are the xml request & response:<br><br>';
echo '$client->__getLastRequest():<br><pre>' . $client->__getLastRequest() . '</pre>';
echo '$client->__getLastResponse():<br><pre>' . $client->__getLastResponse() . '</pre><br>';
echo '<p>Exception trying to call ' . $method . '</p>';
echo '$e->getMessage()';
echo '<pre>' . $e->getMessage() . '</pre>';
}
Выход этого:
Exception caught. Here are the xml request & response:
$client->__getLastRequest():
[token was here]
$client->__getLastResponse():
soapenv:Server.userException com.ebay.app.pres.service.hosting.WebServiceDisabledException: The web service eBayAPI is not properly configured or not found and is disabled.
Exception trying to call GeteBayOfficialTime
$e->getMessage()
com.ebay.app.pres.service.hosting.WebServiceDisabledException: The web service eBayAPI is not properly configured or not found and is disabled.
Может кто-нибудь помочь мне заставить это работать? Частично проблема может заключаться в том, что я понятия не имею, что должно идти в первом параметре функции SoapHeader ("Пространство имен»).