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

Problems with basic Magento SOAP API example
 
Arne Steinarson
Jr. Member
 
Total Posts:  7
Joined:  2008-12-13
 

I’m having problem getting basic Magento SOAP API to work (at all). I’m trying this: http://www.magentocommerce.com/wiki/doc/webservices-api/introduction. This is the result in firefox:

WarningSoapClient::SoapClient(http://www.magento.se/magento/api/soap/?wsdl) [function.SoapClient-SoapClient]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/msoap.php on line 9

This is the failing line(1st line of script):

$proxy = new SoapClient('http://www.magento.se/magento/api/soap/?wsdl');

My Magento setup:
- Ubuntu Linux + Apache2 + PHP and all required modules [yes, phpinfo() says SOAP and WSDL is working)]
- Webserver is running on dev machine (on 127.0.0.1).
- I’ve inserted the line:

127.0.0.1     www.magento.se
in my /etc/hosts

I downloaded Magento from SVN and followed setup instructions. It went fine and I can access both front end and back end.

Searching through this forum, I’ve found a collection of alternative URL:s for the wsdl query:

http://www.magento.se/api/soap/?wsdl # The original from the sample
http://www.magento.se/magento/api/soap/?wsdl # But Magento is one dir down!
http://www.magento.se/index.php/api/soap/?wsdl # Someone suggests going through index.php
http://www.magento.se/magento/index.php/api/soap/?wsdl # A combination

They all fail the same way here. But surely ‘magento’ must be there after server name since ‘index.php’ is located in ‘magento’ subdir from httpd root?

I also try replacing http://www.magento.se with 127.0.0.1 with same result.

Trying the WSDL URL directly in a browser, I come to a “Magento URL not found page”: “Whoops, our bad… The page you requested...”. So it seems my local Magento is unable to serve any WSDL whatsoever.

Now I wonder:

- Is there some ‘master switch’ in Magento somewhere to get SOAP functionality up and running?
- Is there some other basic configuration that needs to be done (like in Admin > System > Configuration) [I haven’t changed anything here].

I’m fairly new on PHP/Apache configuration, so I may have missed something there.

Any good advice appreciated!

Thanks
// Arst

 
Magento Community Magento Community
Magento Community
Magento Community
 
hmpierson
Sr. Member
 
Total Posts:  101
Joined:  2008-11-15
 

this might help…

http://www.magentocommerce.com/boards/viewthread/24991/

 
Magento Community Magento Community
Magento Community
Magento Community
 
aledujke
Jr. Member
 
Total Posts:  18
Joined:  2008-09-18
Belgrade
 

This helped me:
go to; Catalog->Url Rewrite Management

then add a new one…
Type = Custom
chose any store you wish,
request path = wdsl.html
Id Path = punch in some number
Target Path = /api/soap/index/wsdl/1 <- relative to your instalation
redirect = No <- I’m not sure what this is so I just left it at default…

you see the xml instead of 401 page when you visit

http://www.yourshop.com/yourShopFolderIfAny/storeYouchosen/wdsl.html

so now in your example try with:

$proxy = new SoapClient('http://www.yourshop.com/yourShopFolderIfAny/storeYouchosen/wdsl.html');

I can get a xml now but I have other problems which I’ll fix somehow smile

cheers!

 
Magento Community Magento Community
Magento Community
Magento Community
 
aledujke
Jr. Member
 
Total Posts:  18
Joined:  2008-09-18
Belgrade
 

hmmm it seems my problem was that I did not include my store view in the path… So I do not need to use the url rewrite after all.

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

If you have “Append store code to URLs” turned on in system configuration, you have to modify api url accordingly - http://my.magento.com/my_magento_path/STORE_CODE/api/....

 
Magento Community Magento Community
Magento Community
Magento Community
 
ds1122
Jr. Member
 
Total Posts:  11
Joined:  2008-08-21
 

I have exactly the same problem and I’ve been struggling for 2 days now to make the SOAP API work on XAMPP+Vista. I’ve tried all kinds of url’s but it still gives

WarningSoapClient::SoapClient(http://localhost/magento/index.php/api/?wsdl) [function.SoapClient-SoapClient]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\magento\soap.php on line 4

WarningSoapClient::SoapClient() [function.SoapClient-SoapClient]I/O warning failed to load external entity "http://localhost/magento/index.php/api/?wsdl" in C:\xampp\htdocs\magento\soap.php on line 4

Fatal error
Uncaught SoapFault exception[WSDL] SOAP-ERRORParsing WSDLCouldn't load from 'http://localhost/magento/index.php/api/?wsdl' in C:\xampp\htdocs\magento\soap.php:4 Stack trace: #0 C:\xampp\htdocs\magento\soap.php(4): SoapClient->SoapClient('http://localhos...') #1 {main} thrown in C:\xampp\htdocs\magento\soap.php on line 4
What’s strange is that it works on XAMPP + WinXP, but I can’t make it work on my Vista machine. I tried switching off all firewall protection, but still nothing.
 
Magento Community Magento Community
Magento Community
Magento Community
 
Praveen Kumar Reddy
Jr. Member
 
Total Posts:  7
Joined:  2009-01-06
 

Hi,

Where do we need tp place our soap client in Magento Dir???

Highly appreciated if Anyone help in this regard.

Thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MC Cojoness
Jr. Member
 
Total Posts:  1
Joined:  2009-04-10
 

@ds1122

I had the same problem with Windows Vista. The solution is the following:

Open the “hosts” file from “C:\windows\system32\drivers\etc”

Comment the line “::1” (like this: “# ::1")

This worked for me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
devon.humes
Jr. Member
 
Total Posts:  6
Joined:  2010-04-20
 

Hey we have a different, but related error with SOAP.  When we try to use the SOAP with Magento 1.4.1.1 we get an error (obviously sensitive data has been edited out):

SoapFault exception[WSDL] SOAP-ERRORParsing WSDLCouldn\'t load from \'http://domain/index.php/api/v2_soap/index/wsdl/1/\' : failed to load external entity \"http://domain/index.php/api/v2_soap/index/wsdl/1/\" in /var/www/domain/sebo-mage/classes/product.php:43 Stack trace: #0 [internal function]: SoapClient->__call(\'login\', Array) #1 /var/www/domain/sebo-mage/classes/product.php(43): SoapClient->login(\'usr\', \'**************\') #2 /var/www/domain/sebo-mage/classes/product.php(122): Sm_product->Sm_product(5, NULL) #3 /var/www/domain/secure-clean-test.php(71): Sm_product::factory(5) #4 {main}

It is not failing at the call to connect but the call to login.  We have reset the password for the user multiple times and we have a different staging site on the same server that can successfully connect to another Magento installation(ver. 1.3.2.4).  We have tried version 1 and 2 of SOAP.  This is the php code we are using for SOAP? 

try {
        
// Set up webservice through a soap client
        
$proxy = new SoapClient(STORE_URL \'api/v2_soap/?wsdl=1\', array(\'trace\' => 1\"connection_timeout\" => 120));
        
//$sessionId = $proxy->__soapCall(\"login\", array(SOAP_USER, SOAP_PASSWORD));
        
$sessionId $proxy->login(SOAP_USERSOAP_PASSWORD);
        
$product $proxy->call($sessionId\'catalog_product.info\', array($this->id));
        
$productImg $proxy->call($sessionId\'catalog_product_attribute_media.list\', array($this->id));
        
$productStock $proxy->call($sessionId\'cataloginventory_stock_item.list\', array($product[\'sku\']));
        echo 
\'success\';
        
catch(SoapFault $exception{
            
echo \'EXCEPTION=\'.$exception;
        
}

Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
G_Mehta
Guru
 
Avatar
Total Posts:  418
Joined:  2010-01-27
India
 

same hear

i am trying from last hours to connect with SOAP. but every time it through following exception:

SoapFault exception: [soapenv:Receiver] ErrorMessage in D:\\vhosts\\127.0.0.1\\public_html\\lib\\Zend\\Soap\\Client.php:1090
Stack trace:
#0 D:\\vhosts\\127.0.0.1\\public_html\\lib\\Zend\\Soap\\Client.php(1090): SoapClient->__soapCall(\’orderCheck\’, Array, NULL, NULL, Array)
#1 [internal function]: Zend_Soap_Client->__call(\’orderCheck\’, Array)
#2 D:\\vhosts\\127.0.0.1\\public_html\\app\\code\\local\\..\\<module>\\TestController.php(58): Zend_Soap_Client->orderCheck(Array)
#3 D:\\vhosts\\127.0.0.1\\public_html\\app\\code\\core\\Mage\\Core\\Controller\\Varien\\Action.php(418): <codepool>_<module>_TestController->indexAction()
#4 D:\\vhosts\\127.0.0.1\\public_html\\app\\code\\core\\Mage\\Core\\Controller\\Varien\\Router\\Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch(\’index\’)
#5 D:\\vhosts\\127.0.0.1\\public_html\\app\\code\\core\\Mage\\Core\\Controller\\Varien\\Front.php(177): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#6 D:\\vhosts\\127.0.0.1\\public_html\\app\\code\\core\\Mage\\Core\\Model\\App.php(304): Mage_Core_Controller_Varien_Front->dispatch()
#7 D:\\vhosts\\127.0.0.1\\public_html\\app\\Mage.php(596): Mage_Core_Model_App->run(Array)
#8 D:\\vhosts\\127.0.0.1\\public_html\\index.php(80): Mage::run(\’\’, \’store\’)
#9 {main}

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sam rosers
Jr. Member
 
Total Posts:  6
Joined:  2010-08-30
 

I was the same problem with soap client.
Please follow at
http://stackoverflow.com/questions/14746359/soap-api-throwing-session-expired-error-using-nu-soap-in-magento/14785740#14785740

Suppose u have any issue related to soap access denied or so , please call me at 9654882254 at delhi india

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top