【发布时间】:2012-05-17 20:44:27
【问题描述】:
我实现了一个重新索引 API 调用。对于类别索引,它按预期工作。对于产品索引(处理大约需要 3 分钟),会启动一个过程,但大约需要 3 分钟。 45 秒后,我收到“无效 XML”响应。 看起来,执行时间存在问题。我确实将参数 max_execution_time 更改为 600(秒)。我启用了日志记录,但没有出现异常或错误。在索引管理 GUI 中,我看到重新索引过程开始并在返回响应(无效 XML)后 2 分钟成功完成(重新索引总时间约为 3 分钟)。
API 的代码看起来不错,因为我可以更新所有索引,除了产品价格和产品平面数据。
有什么想法吗?
使用wireshark: 要求: POST /index.php/api/v2_soap/index/ HTTP/1.1 用户代理:Mozilla/4.0(兼容;MSIE 6.0;MS Web 服务客户端协议 2.0.50727.3053) VsDebuggerCausalityData: uIDPo6o2uSDL0oVKpqKJjDrFPsEAAAAAJt2oK8A51UOeAJsKkziyy/q2t81fNIxMnAvF+VaT7jIACQAA 内容类型:文本/xml;字符集=utf-8 SOAPAction:“urn:Mage_Api_Model_Server_V2_HandlerAction” 主机:XXXXXXXXXXXX(出于安全原因隐藏 内容长度:609 期望:100-继续 HTTP/1.1 100 继续
<?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 内部服务错误 日期:格林威治标准时间 2012 年 5 月 18 日星期五 20:50:22 服务器:阿帕奇 X-Powered-By: PHP/5.2.17 内容长度:269 连接:关闭 内容类型:文本/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;
}
【问题讨论】:
-
您的 SOAP 客户端调用无效的响应 XML 代码是什么样的?
标签: magento