I'm trying to use Magento's SOAP V2 api. The URI path for the API is http://www.example.com/api/v2_soap. When I'm making my request I'm using http://www.example.com/api/v2_soap?wsdl. The request correctly shows the wsdl xml file but if I try to run this code from the command line I get an error that says 'looks like we got no XML document':

                $client = new SoapClient('http://www.example.com/api/v2_soap?wsdl');
                $session = $client->login('username', 'apiKey');

    }catch(Exception $e){

I believe I've narrowed this down to the soap:address in the wsdl file. The location value is set to the index.php file rather than the api path or the api.php file.

<service name="MagentoService">
  <port name="Mage_Api_Model_Server_V2_HandlerPort" binding="typens:Mage_Api_Model_Server_V2_HandlerBinding">
  <soap:address location="http://www.example.com/index.php/?type=v2_soap"/>

I can't quite find where this url is generated or how to change it to the correct value.

In addition to using http://www.example.com/api/v2_soap?wsdl I've also tried using http://www.example.com/index.php/api/v2_soap?wsdl as I've seen mentioned in other questions, but that doesn't have any effect on the address location value.

Any help to point me in the right direction would be greatly appreciated.

  • The error message you are getting is thrown by PHP, not Magento. Commented Jan 26, 2015 at 18:43
  • Did you solve this? I think that isn't the correct way to connect to SOAP v2
    – Natalie
    Commented Apr 15, 2015 at 21:48
  • The URL is generated in: /app/code/core/Mage/Api/Model/Wsdl/Config/Base.php around line 57 as reporter here: magento.stackexchange.com/questions/74753/…
    – WaPoNe
    Commented Oct 26, 2016 at 15:33

1 Answer 1


Hope you have created users and assigned role, below article will guide to do so, I have also included sample php code which works well


Now to be specific about your questions, do check your .htaccess file redirection rules, it might be possible some of redirection might be sending request to different url than you are intentded to do.

  • The page no longer exists.
    – jstuardo
    Commented Apr 12, 2019 at 22:51
  • Edited link in answer...please check now.. Commented Apr 14, 2019 at 4:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.