Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 3
1.1 Beta Webservices API Problems
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

I just downloaded the 1.1 beta and having trouble with the new Webservices API

The following error in the Admin’s System->Web Services->Users or Roles:

NoticeTrying to get property of non-object  in C:\Program Files\Apache\Apache2.2\htdocs\magento\app\code\core\Mage\Core\Model\Config.php on line 739

#0 C:\Program Files\Apache\Apache2.2\htdocs\magento\app\code\core\Mage\Core\Model\Config.php(739): mageCoreErrorHandler(8, 'Trying to get p...', 'C:\Program File...', 739, Array)
#1 C:\Program Files\Apache\Apache2.2\htdocs\magento\app\Mage.php(315): Mage_Core_Model_Config->getResourceModelInstance('api/user_collec...', Array)
#2 C:\Program Files\Apache\Apache2.2\htdocs\magento\app\code\core\Mage\Adminhtml\Block\Api\User\Grid.php(42): Mage::getResourceModel('api/user_collec...')
#3 C:\Program Files\Apache\Apache2.2\htdocs\magento\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(438): Mage_Adminhtml_Block_Api_User_Grid->_prepareCollection()
#4 C:\Program Files\Apache\Apache2.2\htdocs\magento\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(444): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
#5 C:\Program Files\Apache\Apache2.2\htdocs\magento\app\code\core\Mage\Core\Block\Abstract.php(579): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml()
#6 C:\Program Files\Apache\Apache2.2\htdocs\magento\app\code\core\Mage\Core\Block\Abstract.php(445): ...

I’m also having problems when I try to use the API to try to connect using:

<?php
$client 
= new SoapClient('http://localhost/magento/api/soap/?wsdl');
$products $client->call('product.list');
var_dump($products);
?>

I’m getting

PHP error:
Warning: SoapClient::SoapClient(http://localhost/magento/api/soap/?wsdl) [soapclient.soapclient]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found…

Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity “http://localhost/magento/api/soap/?wsdl”

I’m thinking this might be related the fact that the webservices in Admin doesnt work either.

I did find in mysql4-install-0.7.0.php in magento\app\code\core\Mage\Api\sql\api_setup, notice the “api_setup” part.  I’m wondering if I’m supposed to run this script before using the API.

Anyone have any ideas that may help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Unirgy
Guru
 
Avatar
Total Posts:  478
Joined:  2007-09-07
 

i’m not sure about your first problem, but for 2nd, try: http://localhost/magento/index.php/api/soap/?wsdl

 
Magento Community Magento Community
Magento Community
Magento Community
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

I do have mod_rewrite enabled (and working), but I tried that as well and I’m still getting the same error message.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

Same here >:(

NoticeTrying to get property of non-object  in C:\wamp\www\svn_magento_syn_11\private\source\magento\app\code\core\Mage\Core\Model\Config.php on line 739

#0 C:\wamp\www\svn_magento_syn_11\private\source\magento\app\code\core\Mage\Core\Model\Config.php(739): mageCoreErrorHandler(8, 'Trying to get p...', 'C:\wamp\www\svn...', 739, Array)
#1 C:\wamp\www\svn_magento_syn_11\private\source\magento\app\Mage.php(315): Mage_Core_Model_Config->getResourceModelInstance('api/user_collec...', Array)
#2 C:\wamp\www\svn_magento_syn_11\private\source\magento\app\code\core\Mage\Adminhtml\Block\Api\User\Grid.php(42): Mage::getResourceModel('api/user_collec...')
#3 C:\wamp\www\svn_magento_syn_11\private\source\magento\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(438): Mage_Adminhtml_Block_Api_User_Grid->_prepareCollection()
#4 C:\wamp\www\svn_magento_syn_11\private\source\magento\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php(444): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
 
Magento Community Magento Community
Magento Community
Magento Community
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

I just posted a bug report (#5859) for the Admin’s Webservices issue.  Apparently 1.1 Alpha had the same issue (#5722), but was resolved somehow.

I’m still trying to see if using the Core API with the SOAP client is affected by this issue (since it can’t find the wsdl file) and whether or not the “api_setup” needs to be run.

 
Magento Community Magento Community
Magento Community
Magento Community
 
oehoff
Jr. Member
 
Total Posts:  18
Joined:  2007-12-07
Trondheim, Norway
 

Got some problems with SOAP also,
Trying to open: http://localhost/magento/index.php/api/soap/?wsdl or http://localhost/magento/index.php/api/?wsdl
Result:
Fatal error: Class ‘SoapServer’ not found in C:\wamp\www\magento\app\code\core\Mage\Api\Model\Server\Adapter\Soap.php on line 117

Do I need to enable SOAP service? if so, how do I do that?

Best regards
Ørjan

 
Magento Community Magento Community
Magento Community
Magento Community
 
oehoff
Jr. Member
 
Total Posts:  18
Joined:  2007-12-07
Trondheim, Norway
 

I’ll answere my own post, I forgott to enable SOAP extension in PHP…

Best regards
Ørjan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Suzy
Jr. Member
 
Total Posts:  6
Joined:  2008-07-10
 

I am also unable to get results from the SoafCient
Warning: SoapClient::SoapClient(http://localhost/camptowngolf/index.php/api/soap/?wsdl) [function.SoapClient-SoapClient]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found on line 11

If I initialize the magento environment, I do not get an error, but the script stops running.
<?php

// initialize magento environment for 'default' store
require_once 'app/Mage.php';
Mage::app('default');

echo "here I am";

$client = new SoapClient('http://localhost/magento/index.php/api/soap/?wsdl');

echo " ok";
$products = $client->call('product.list');
var_dump($products);
?>

If anyone can help me solve this, I would appreciate it.
Suzy

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michae1
Enthusiast
 
Total Posts:  826
Joined:  2007-08-31
 

We’ll check this.

Can you please try the latest 1.1 Beta through SVN ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

I still have a problem with the new beta : when I want to add new role :

WarningSimpleXMLElement::addAttribute() [function.SimpleXMLElement-addAttribute]Attribute name and value are required  in /home/users/n.pegourie/www/magento_trunk_svn/lib/Varien/Simplexml/Element.php on line 367

#0 [internal function]: mageCoreErrorHandler(2, 'SimpleXMLElemen...', '/home/users/n.p...', 367, Array)
#1 /home/users/n.pegourie/www/magento_trunk_svn/lib/Varien/Simplexml/Element.php(367): SimpleXMLElement->addAttribute('descr', '')
#2 /home/users/n.pegourie/www/magento_trunk_svn/lib/Varien/Simplexml/Element.php(387): Varien_Simplexml_Element->extendChild(Object(Mage_Core_Model_Config_Element), true)
#3 /home/users/n.pegourie/www/magento_trunk_svn/lib/Varien/Simplexml/Element.php(387): Varien_Simplexml_Element->extendChild(Object(Mage_Core_Model_Config_Element), true)
#4 /home/users/n.pegourie/www/magento_trunk_svn/lib/Varien/Simplexml/Element.php(387): Varien_Simplexml_Element->extendChild(Object(Mage_Core_Model_Config_Element), true)
#5 /home/users/n.pegourie/www/magento_trunk_svn/lib/Varien/Simplexml/Element.php(387): Varien_Simplexml_Element->extendChild(Object(Mage_Core_Model_Config_Element), true)
#6 /home/users/n.pegourie/www/magento_trunk_svn/lib/Varien/Simplexml/Element.php(326): Varien_Simplexml_Element->extendChild(Object(Mage_Core_Model_Config_Element), true)
#7 /home/users/n.pegourie/www/magento_trunk_svn/lib/Varien/Simplexml/Config.php(586): Varien_Simplexml_Element->extend(Object(Mage_Core_Model_Config_Element), true)
#8 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Api/Model/Config.php(72): Varien_Simplexml_Config->extend(Object(Mage_Core_Model_Config_Base), true)
#9 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Api/Model/Config.php(43): Mage_Api_Model_Config->_construct()
#10 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Core/Model/Config.php(715): Mage_Api_Model_Config->__construct(Array)
#11 /home/users/n.pegourie/www/magento_trunk_svn/app/Mage.php(287): Mage_Core_Model_Config->getModelInstance('api/config', Array)
#12 /home/users/n.pegourie/www/magento_trunk_svn/app/Mage.php(301): Mage::getModel('api/config', Array)
#13 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Api/Model/Roles.php(64): Mage::getSingleton('api/config')
#14 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Api/Model/Roles.php(46): Mage_Api_Model_Roles->_buildResourcesArray()
#15 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php(78): Mage_Api_Model_Roles->getResourcesList()
#16 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Core/Controller/Varien/Action.php(343): Mage_Adminhtml_Api_RoleController->editRoleAction()
#17 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php(137): Mage_Core_Controller_Varien_Action->dispatch('editrole')
#18 /home/users/n.pegourie/www/magento_trunk_svn/app/code/core/Mage/Core/Controller/Varien/Front.php(168): Mage_Core_Controller_Varien_Router_Admin->match(Object(Mage_Core_Controller_Request_Http))
#19 /home/users/n.pegourie/www/magento_trunk_svn/app/Mage.php(420): Mage_Core_Controller_Varien_Front->dispatch()
#20 /home/users/n.pegourie/www/magento_trunk_svn/index.php(46): Mage::run()
#21 {main}
 
Magento Community Magento Community
Magento Community
Magento Community
 
Killoff
Magento Team
 
Avatar
Total Posts:  17
Joined:  2008-05-22
 

What version of PHP do you use?
Actually, such error cannot occur. The method addAttribute() allows empty value pass.
I think you have this problem http://bugs.php.net/bug.php?id=41175

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

I use php 5.2.0 (5.2.0-8+etch11)
You’ve probably right, i think i have the problem you said. I will try to upgrade my php version.
thanks for the anwser.

 
Magento Community Magento Community
Magento Community
Magento Community
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

So, I’ve tried intializing the magento environment which got rid of the error, but the script stops like Suzy said.

here I am

I then downloaded the new beta in the 1.1-trunk release and get the same results.

The new beta fixes the Webservices->Users/Roles problem, so I was able to create a user with a role with all priviledges.

I then tried the code with the new user credentials.

Heres my code: (Edited with fake passwords)

<?php

// initialize magento environment for 'default' store 
require_once('../magento-b2/app/Mage.php'); 
Mage::app('default'); 

echo 
"here I am";

$client = new SoapClient('http://localhost/magento/api/soap/?wsdl');

echo 
"client done";

$session $client->login('apiUser''apiKey');

echo 
" ok";
$products $client->call($session'product.list');

var_dump($products);

$client->endSession($session);

?>

I still just get up to the “here I am” part.  So the SoapClient seems to fail somehow.

 
Magento Community Magento Community
Magento Community
Magento Community
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

Ok, I guess I was too quick, I noticed that I put in the wrong path for the SoapClient constructor, it should be “magento-b2” (at least for my new beta install).  It now works with the new beta and using an api user/key combo created from Webservices->Users/Roles.

However, without the api user/key session token, it looks like “product.list” may be restricted from use.  I’m not sure, here’s the PHP error:

Fatal errorUncaught SoapFault exception[3] Invalid api pathin C:\Program Files\Apache\Apache2.2\htdocs\Convert\connect.php:12 Stack trace#0 [internal function]: SoapClient->__call('call', Array) #1 C:\Program Files\Apache\Apache2.2\htdocs\Convert\connect.php(12): SoapClient->call('product.list') #2 {main} thrown in C:\Program Files\Apache\Apache2.2\htdocs\Convert\connect.php on line 12
 
Magento Community Magento Community
Magento Community
Magento Community
 
Suzy
Jr. Member
 
Total Posts:  6
Joined:  2008-07-10
 

Can you please display the complete code that worked for you?  Also, what password is needed?  Magento admin or the database or the Linux server?

Thanks so much.

 
Magento Community Magento Community
Magento Community
Magento Community
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

Here’s the code I used:

<?php

// initialize magento environment for 'default' store 
require_once('../magento-b2/app/Mage.php'); 
Mage::app('default'); 

$client = new SoapClient('http://localhost/magento-b2/api/soap/?wsdl');
$session $client->login('apiUser''apiKey');  //User/Key created through Admin's System->Webservices->Users/Roles

$products $client->call($session'product.list');

var_dump($products);

$client->endSession($session);

?>

User/Key created through Admin’s System->Webservices->Users/Roles

Replace “magento-b2” with your own magento directory.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3