兼容Magento WS-I的v2 API WSDL Web服务SOAP-ERROR:编码:对象没有'sessionId'属性 [英] Magento WS-I compliant v2 API WSDL web service SOAP-ERROR: Encoding: object has no 'sessionId' property
本文介绍了兼容Magento WS-I的v2 API WSDL Web服务SOAP-ERROR:编码:对象没有'sessionId'属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在以WS-I兼容模式使用Magento v2 Web服务
I'm using Magento v2 web service in WS-I compliant mode
当尝试列出产品时,我得到例外
when try to list product i get exception
SOAP-ERROR: Encoding: object has no 'sessionId' property
我的代码在下面列出
$proxy = new SoapClient('http://127.0.0.1/Magento1620/index.php/api/v2_soap?wsdl', array('trace' => 1, 'connection_timeout' => 120));
$sessionId = $proxy->login(array(
'username' => "zzc000",
'apiKey' => "zzc000"
));
$filters = array(
'sku' => array('like'=>'zol%')
);
$products = $proxy->catalogProductList($sessionId, $filters);
请帮助,谢谢
推荐答案
在 WS-I模式中,使用API时有次要差异.
In WS-I mode, there are some minor differences in using the API.
- $ proxy-> login()的结果是一个对象.您需要提取sessionId.
- 调用$ proxy-> catalogProductList()时,需要在关联数组中提供参数(就像使用$ proxy-> login()一样).
请尝试以下操作:
<?php
try {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
$proxy = new SoapClient('http://127.0.0.1/Magento1620/index.php/api/v2_soap?wsdl', array('trace' => 1, 'connection_timeout' => 120));
$session = $proxy->login(array(
'username' => "zzc000",
'apiKey' => "zzc000"
));
$sessionId = $session->result;
$filters = array(
'sku' => array('like'=>'zol%')
);
$products = $proxy->catalogProductList(array("sessionId" => $sessionId, "filters" => $filters));
echo '<h1>Result</h1>';
echo '<pre>';
var_dump($products);
echo '</pre>';
} catch (Exception $e) {
echo '<h1>Error</h1>';
echo '<p>' . $e->getMessage() . '</p>';
}
对于适用于WS-I的v2 SOAP API的其他方法调用也是如此.
The same applies to other method calls for the WS-I compliant v2 SOAP API.
这篇关于兼容Magento WS-I的v2 API WSDL Web服务SOAP-ERROR:编码:对象没有'sessionId'属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文