Search code examples
magentomagento-soap-api

Magento SOAP login error; http internal server error


Magento SOAP is working in my local system. when I put in live server I am getting client value in below code.. I tried all solution by changing run method mentioned in below thread.

When login() called using user name and password I am getting following error : enter image description here

I am using below code and host server using centos

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

$sessionId = $client->login("username","apipass");

Solution

  • First run the url http://hostserverm/api/soap?wsdl in your browser. You should get some XML document as response.

    Thenafter, cross-confirm that the username and password that you are using actually exist on your server site. You can cross-check/create it from

    Magento Admin > System > Web Services > Soap/XML-RPC Users.

    Then cross check that the user has a proper role and resources assigned, from:

    Magento Admin > System > Web Services > Soap/XML-RPC Roles.

    Now check your phpinfo() to ensure that the server has SOAP related resources installed. Sometimes necessary plug-ins like php_soap,soap.so are not enabled and this can cause the issue. Check this URL for details: https://www.yireo.com/tutorials/magento/magento-programming/629-connecting-to-magento-with-soap-part-1

    Next write this in your file and make sure you use the correct case to avoid problems related to case-sensitivity:

    try {
    $client = new SoapClient('http://hostserverm/soap/api/?wsdl');
    $session = $client->login('apiUserName', 'apiPassword');
    $client->endSession($session);
    } catch(Exception $ex) {
    echo $ex->getMessage();
    }
    

    Hope this helps!!