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
my code is listed below
$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);
Please help, thanks
In WS-I mode, there are some minor differences in using the API.
Please try this:
<?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>';
}
The same applies to other method calls for the WS-I compliant v2 SOAP API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With