0

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'));
    }

ご覧のとおり、ロガーを取り付けました。ロガーは、これが行われている要求であることを示しています。

<?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>

そして、これが返される応答です。

<?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>

私の ebay.config.php ファイルにはすべて正しいキーが含まれており、私が知る限り、すべて正しい情報が含まれています。誰かが解決のヒントを持っていますか?

ダニー

4

1 に答える 1

1

この問題は、eBatNS API が新しいトークンを取得するためのリクエストで前のリクエストからトークンを送信したことが原因でした。これは ebay ではサポートされていません。

これは、セッションのトークン モードを 0 または false に設定することで解決されます。

$session->setTokenMode(0)
于 2013-09-24T14:36:15.297 に答える