Soap eBatNS交易API试图获取SessionID时出现身份验证问题

Soap eBatNS交易API试图获取SessionID时出现身份验证问题,soap,ebay-api,trading,Soap,Ebay Api,Trading,我正在尝试使用eBatNS SOAP API获取会话ID 进行调用的函数非常简单,但总是返回身份验证错误。您可以看到下面的函数 public function get_ebay_session() { error_reporting(0); $ruName = "Forward_Thinker-ForwardT-57fe-4-rybapdi"; $sessionID = ""; //Connect to eBay and

我正在尝试使用eBatNS SOAP API获取会话ID

进行调用的函数非常简单,但总是返回身份验证错误。您可以看到下面的函数

public function get_ebay_session()
    {
        error_reporting(0);
        $ruName = "Forward_Thinker-ForwardT-57fe-4-rybapdi";
        $sessionID = "";

        //Connect to eBay and get a list of all products
        require_once 'eBay/EbatNs/EbatNs_ServiceProxy.php';
        require_once 'eBay/EbatNs/GetSessionIDRequestType.php';
        require_once 'eBay/EbatNs/EbatNs_Logger.php';

        //Get a SessionID
        $session = new EbatNs_Session('eBay/config/ebay.config.php');
        print_r($session);
        echo "<hr>";

        $cs = new EbatNs_ServiceProxy($session);
        $cs->attachLogger(new EbatNs_Logger(false, 'stdout', true, false));
        print_r($cs);
        echo "<hr>";

        $req = new GetSessionIDRequestType();
        $req->setRuName($ruName);
        print_r($req);
        echo "<hr>";

        $result = $cs->GetSessionID($req);

        $sessionID = $result->SessionID;

        print_r($result);
        echo "<hr>";

        session_start();
        $_SESSION['eBaySessionID'] = $sessionID;

        $return = $ruName."\n".$sessionID;
        $this->set(compact('return'));
    }
公共函数get\u ebay\u session()
{
错误报告(0);
$ruName=“Forward\u-ForwardT-57fe-4-rybapdi”;
$sessionID=“”;
//连接到易趣并获取所有产品的列表
需要_once“eBay/EbatNs/EbatNs_ServiceProxy.php”;
需要一次“eBay/EbatNs/getSessiondRequestType.php”;
需要_once“eBay/EbatNs/EbatNs_Logger.php”;
//获取会话ID
$session=newebatns_session('eBay/config/eBay.config.php');
打印(会话);
回声“
”; $cs=新的EbatNs_服务代理($session); $cs->attachLogger(新的EbatNs_记录器(false,'stdout',true,false)); 印刷费($cs); 回声“
”; $req=新的GetSessiondRequestType(); $req->setRuName($ruName); 打印费用($req); 回声“
”; $result=$cs->GetSessionID($req); $sessionID=$result->sessionID; 打印(结果); 回声“
”; 会话_start(); $\会话['eBaySessionID']=$sessionID; $return=$ruName.“\n”。$sessionID; $this->set(压缩('return'); }
正如你所看到的,我附加了一个记录器。记录器显示这是正在发出的请求

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns="urn:ebay:apis:eBLBaseComponents" ><soap:Header><RequesterCredentials><eBayAuthToken>AgAAAA**AQAAAA**aAAAAA**wS7oUQ**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wHloSkD5aGog+dj6x9nY+seQ**It4BAA**AAMAAA**CB7yrHTyG3kQbA6KOwf0ZO2MqyPs/Dfn5u5r8ZDVGeWNvB</eBayAuthToken><Credentials><AppId>ForwardT-57fe-41ea-b90e-52fd0b541b88</AppId><DevId>5eefba38-e226-4876-9ada-d8743f571aeb</DevId><AuthCert>b57984cb-ba9c-430c-a8fc-c08f9ac46e75</AuthCert></Credentials></RequesterCredentials></soap:Header><soap:Body><GetSessionIDRequest><Version><![CDATA[815]]></Version><RuName><![CDATA[Forward_Thinker-ForwardT-57fe-4-rybapdi]]></RuName></GetSessionIDRequest></soap:Body></soap:Envelope>
AgAAAA**AQAAAA**AAAA**wS7oUQ**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wHloSkD5aGog+dj6x9nY+seQ**It4BAA**AAMAAA**CB7YRHTYG3KQBA6KOWF02MYPS/DFN5U5R8ZDVGEWNWNBFORADT-57fe-41ea-b90e-52fd0b541b885eefba38-e226-4876-9ada-D8743F577AEBB984CB-BAC-430c-A8C075
这就是返回的响应:

<?xml version="1.0" encoding="UTF-8"?>
<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">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:FailedCheck</faultcode>
   <faultstring>Authorisation token is invalid.</faultstring>
   <faultactor>http://www.ebay.com/ws/websvc/eBayAPI</faultactor>
   <detail>
    <FaultDetail>
     <ErrorCode>931</ErrorCode>
     <Severity>Error</Severity>
     <DetailedMessage>Validation of the authentication token in API request failed.</DetailedMessage>
    </FaultDetail>
   </detail>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

ns1:失败检查
授权令牌无效。
http://www.ebay.com/ws/websvc/eBayAPI
931
错误
验证API请求中的身份验证令牌失败。
我的ebay.config.php文件包含所有正确的密钥,而且据我所知,所有信息都是正确的。有人有解决问题的建议吗


Danny

此问题是由eBatNS API从请求中的前一个请求发送令牌以获取新令牌引起的。ebay不支持此操作

这可以通过将会话上的令牌模式设置为0或false来解决

$session->setTokenMode(0)