0

When I try to access the API, i get an error, i start the connection with this:

$api = new SoapClient(BASE_URL."/api/?wsdl");

Note: The URL is fine.

I've been making a plugin, and it worked on my 1.7.0.2 version, but now I tried on a 1.7.0.2 version in another person Magento, and it reports an error.

    a:5:{i:0;s:152:"SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://WEBSITE.com//api/?wsdl' : failed to load external entity "http://WEBSITE.com//api/?wsdl" 
";i:1;s:3536:"#0 /var/www/clients/client20/web25/web/app/design/adminhtml/default/default/template/moloni/classes/core.class.phtml(283): SoapClient->SoapClient('http://WEBSITE...') 

When I try to access that page, if i'm logged in the backoffice, the XML api file show's up well, but if I start a private session, it doesn't return nothing.

Thank you

2 Answers 2

3

You need to enable API calls in your .htaccess file. Remove '#' in the line

#    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

EDIT This line add URL rewrite rule for webserver rewrite engine which redirect all /api/[type] calls to api.php file. You want to avoid using RewriteEngine for your API calls you can try to use api.php directly, like this

$api = new SoapClient(BASE_URL."/api.php?type=soap");

The type parameter specify which protocol you want to use. Out of the box magento support xmlrpc, soap, soap_v2 and rest.

Sign up to request clarification or add additional context in comments.

8 Comments

Where is that line? In the root folder it doesn't have a .htaccess there, can I create it? :)
This file bundled with Magento core, may be you can't find it because it's hidden. Try to enable 'show hidden files' in your file manager. You can download sample .htacess file from official Magento repository - svn.magentocommerce.com/source/branches/1.8/.htaccess
If you want to avoid using RewriteEngine for your API calls you can try to use api.php directly, like this $api = new SoapClient(BASE_URL."/api.php?type=soap");
BTW, if you open URL WEBSITE.com//api/?wsdl in your browser you may see more details about your the problem.
if I try to load it like that, i get this error: <SOAP-ENV:Envelope xmlns:SOAP-ENV="schemas.xmlsoap.org/soap/envelope"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>WSDL</faultcode> <faultstring> SOAP-ERROR: Parsing WSDL: Couldn't load from 'perfumesbook.com/index.php/?type=soap&wsdl=1' : failed to load external entity "perfumesbook.com/index.php/?type=soap&wsdl=1" </faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
|
0

Also make sure that following the services are enabled S0AP, php_openssl, openssl, curl these services should be enabled.

call soap client like $api = new SoapClient('http://website.com/api/v2_soap?wsdl=1');

5 Comments

Yes, they are enable :)
I feel you should do the entry in host file for other
Nop, there is not a code like that in there s: And it doesn't even returns a error, it just returns a blank page when i try to access without beeing logged in the backoffice s:
try something like $api = new SoapClient('website.com/api/v2_soap?wsdl=1');
Ok, i'il do that on another website to test it, accessing from a external website

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.