Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento api: Invalid webservice adapter specified

Tags:

php

api

magento

Is there anything specific i need to do to get the api in magento working?

I am visiting /api/soap/?wsdl on my local installation (1.7) and it returns the following error:

Invalid webservice adapter specified.

Everything looks enabled in the site but i cant find any info on other steps i need to do to get the api to work.

like image 833
Marty Wallace Avatar asked Dec 18 '12 12:12

Marty Wallace


2 Answers

I've solved this from htaccess by turning off MultiViews option like this:

from

<Directory /var/www/magento>
            Options Indexes FollowSymLinks MultiViews
</Directory>

to

<Directory /var/www/magento>
            Options +Indexes +FollowSymLinks -MultiViews
</Directory>
like image 183
Marian Zburlea Avatar answered Nov 09 '22 23:11

Marian Zburlea


There is a different approach if you want to keep compatibility with old API calls. For some obscure reason, my Apache server doesn't analyze the string ^api/... during the rewrite parsing.

But you can still use http://www.somedomain.com/api/v2_soap?wsdl=1 without changing Magento PHP code. You just need to change the .htaccess like the following:

Replace in .htaccess:

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

by

RewriteRule ^api(\.php)?/([a-z][0-9a-z_]+)/?$ api.php?type=$2 [QSA,L] (see the ^api.php/ instead of ^api/)

And even better if some of you, have http://www.somedomain.com/api/V2_soap?wsdl=1 (V2_soap is uppercase), you will have to add a RewriteMap to use internal apache function to set in lowercase the parameter. Add to your virtual host the RewriteMap:

RewriteMap lc int:tolower

And in the .htaccess

RewriteRule ^api(\.php)?/([a-zA-Z][0-9a-z_]+)/?$ api.php?type=${lc:$2} [QSA,L]

This will set to lowercase the parameter for the api.php script and also accept 'V2_soap' in the regular expression

This last part has been brought by @dreeves in this answer

like image 32
Sylvain Rayé Avatar answered Nov 09 '22 23:11

Sylvain Rayé