Products are showing up on the frontpage in the category.
Need the API.
Using:
<?php
$proxy = new SoapClient('http://foo.com/api/v2_soap/?wsdl', array('trace' => 1)); // TODO : change url
$sessionId = $proxy->login('foo', 'bar'); // TODO : change login and pwd if necessary
$result = $proxy->catalogProductList($sessionId);
var_dump($result);
And I get:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in /home/foo/tmp/magento-test/index.php:5 Stack trace: #0 /home/foo/tmp/magento-test/index.php(5): SoapClient->__call('login', Array) #1 /home/foo/tmp/magento-test/index.php(5): SoapClient->login('foo', 'bar') #2 {main} thrown in /home/foo/tmp/magento-test/index.php on line 5
What's missing?
I have tried catching what is going on with this instead:
<?php
$client = new SoapClient('http://foo.com/api/v2_soap/?wsdl', array('trace' => 1)); // TODO : change url
try {
$sessionId = $client->login('foo', 'bar'); // TODO : change login and pwd if necessary
} catch (SoapFault $e) {
print($client->__getLastResponse());
}
try {
$result = $client->catalogProductList();
} catch (SoapFault $e) {
print($client->__getLastResponse());
}
var_dump($result);
Now I get a redirect to the Magento site and I get:
There has been an error processing your request
Cannot send headers; headers already sent in , line 0
Trace:
#0 /var/www/test/lib/Zend/Controller/Response/Abstract.php(115): Zend_Controller_Response_Abstract->canSendHeaders(true)
#1 /var/www/test/app/code/core/Mage/Core/Model/App.php(1265): Zend_Controller_Response_Abstract->setHeader('Content-Type', 'text/html; char...')
#2 /var/www/test/app/code/core/Mage/Core/Controller/Varien/Front.php(80): Mage_Core_Model_App->getResponse()
#3 /var/www/test/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(202): Mage_Core_Controller_Varien_Front->getResponse()
#4 /var/www/test/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#5 /var/www/test/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#6 /var/www/test/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /var/www/test/index.php(83): Mage::run('', 'store')
#8 {main}
And yes, the user has been created in Webservices / Soap etc.
Hi,
This is confirmed, we're facing the exact same issue with the exact same code example from the documentation.
Is this a bug in the latest Magento?
Erik
The problem arises when trying to create a sessionId:
$sessionId = $client->login('foo', 'bar');
This is where it fails.
Doing a trace on the error we also get the exact same result:
Cannot send headers; headers already sent in , line 0
Trace:
#0 /var/www/test/lib/Zend/Controller/Response/Abstract.php(115): Zend_Controller_Response_Abstract->canSendHeaders(true)
#1 /var/www/test/app/code/core/Mage/Core/Model/App.php(1265): Zend_Controller_Response_Abstract->setHeader('Content-Type', 'text/html; char...')
#2 /var/www/test/app/code/core/Mage/Core/Controller/Varien/Front.php(80): Mage_Core_Model_App->getResponse()
#3 /var/www/test/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(202): Mage_Core_Controller_Varien_Front->getResponse()
#4 /var/www/test/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#5 /var/www/test/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#6 /var/www/test/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /var/www/test/index.php(83): Mage::run('', 'store')
#8 {main}
Hmm.
Going over the server Apache logs:
[Wed Sep 30 12:44:29.775350 2015] [:error] [pid 1061] [client 192.168.1.8:34997] PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0
[Wed Sep 30 12:44:29.775421 2015] [:error] [pid 1061] [client 192.168.1.8:34997] PHP Warning: Cannot modify header information - headers already sent in Unknown on line 0
As the error log from Apache/PHP reveleaed Magento was using a deprecated function. We have been testing on PHP 5.6 latest, whereas when we ran the test on PHP 5.4, the problem was resolved.
Please use below.
I have same problem.my problem solved by set always_populate_raw_post_data to -1 on php.ini.
I find out this by adding "trace"=>1,"exceptions"=>1 on options and use try catch and get __getLastRequest() and __getLastResponse()