reindex API 呼び出しを実装しました。カテゴリ インデックスの場合、期待どおりに機能します。商品インデックス(処理時間約3分)の場合、処理が開始されますが、処理に約3分かかります。45 秒後、「無効な XML」という応答が返されます。どうやら、実行時間の問題があります。パラメータ max_execution_time を 600 (秒) に変更しました。ロギングを有効にしましたが、例外もエラーも発生しません。インデックス管理 GUI で、再インデックス プロセスが開始され、応答 (無効な XML) が返されてから 2 分後に正常に終了したことがわかります (合計再インデックス時間は約 3 分です)。
商品価格と商品フラットデータを除くすべてのインデックスを更新できるので、API のコードは問題ないようです。
何か案が?
using wireshark: Request: POST /index.php/api/v2_soap/index/ HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3053) VsDebuggerCausalityData: uIDPo6o2uSDL0oVKpqKJjDrFPsEAAAAAJt2oK8A51UOeAJsKkziyy/q2t81fNIxMnAvF+VaT7jIACQAA Content -タイプ: テキスト/xml; charset=utf-8 SOAPAction: "urn:Mage_Api_Model_Server_V2_HandlerAction" Host: XXXXXXXXXXXX(セキュリティ上の理由で非表示 Content-Length: 609 Expect: 100-continue HTTP/1.1 100 Continue
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:Magento" xmlns:types="urn:Magento/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns:iwCoreIndexingReindexById>
<sessionId xsi:type="xsd:string">835cfa019572c1a893b3799eecbc6903</sessionId>
<indexId xsi:type="xsd:int">4</indexId>
</tns:iwCoreIndexingReindexById>
</soap:Body>
</soap:Envelope>
応答 (39 秒後!) HTTP/1.1 500 Internal Service Error Date: Fri, 18 May 2012 20:50:22 GMT Server: Apache X-Powered-By: PHP/5.2.17 Content-Length: 269 Connection: close Content -タイプ: テキスト/xml; 文字セット=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>Sender</faultcode>
<faultstring>Invalid XML</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
インデックスの状態は処理中です。したがって、呼び出しが呼び出され、アクションも進行中です。Api.php は次のようになります (このコードは実行され、例外はログに記録されません):
public function indexingReindexById( $indexId ){
$process = Mage::getModel('index/process')->load($indexId);
try{
$process->reindexAll();
} catch(exception $e){
Mage::Log($e->getMessage());
return false;
}
return true;
}