1

I am facing a issue with the SOAP Call request in Magento ver 1.9.1.0. I have tested the code in my local site, it works fine, but when i move the code to my online server it is not working.

I have checked SOAP is enabled in server, Please find the code i used for SOAP call,

$host = "81.82.212.166:8888/magento/index.php"; 
    $username = 'XXXXX';
    $apikey= 'YYYYYYY';
    try
    {
        $client = new SoapClient("http://" . $host . "/api/V2_soap?wsdl=1"); //soap handle
        $session_id = $client->login($username, $apikey);
    } catch (SoapFault $fault)
    {
        trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
    }

When i run the above code faced below error,

Fatal error: SOAP Fault: (faultcode: WSDL, faultstring: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://81.82.212.166:8888/magento/index.php/api/V2_soap?wsdl=1' : failed to load external entity "http://81.82.212.166:8888/magento/index.php/api/V2_soap?wsdl=1" ) in /var/www/html/magento/ingram_import/ingram_category_import.php on line 59

4
  • In username and password, did you use username and apiKay? and could you add the /var/www/html/magento/ingram_import/ingram_category_import.php codes Feb 10, 2015 at 5:59
  • Thanks for Response Rahul,Yeah i have used username and apiKey.I have added the code in my question Rahul.Please find link 81.82.212.166:8888/magento/ingram_import/…
    – user2520
    Feb 10, 2015 at 6:11
  • O.k. Which one is line 59 in the code? Feb 10, 2015 at 6:13
  • Hi Rahul, Line no 59 is trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
    – user2520
    Feb 10, 2015 at 7:16

2 Answers 2

3

Finally, i got it working by using 127.0.0.1 as hostname and used SOAP v2 Calls,

    $client = new SoapClient('http://127.0.0.1/magento/index.php/api/v2_soap/?wsdl');
    $username = 'XXXX';
    $apikey= 'YYYYY';

    $session = $client->login($username, $apikey);

    $result = $client->catalogCategoryInfo($session, '2');

    echo '<pre>' . print_r($result);
0

$client = new SoapClient ('http://127.0.0.1/magento/index.php/api/v2_soap/?wsdl'); $username = 'XXXX'; $apikey= 'YYYYY';

$session = $client->login($username, $apikey);

$result = $client->catalogCategoryInfo($session, '2');

echo '<pre>' . print_r($result);

can anyone tell me how to call this endpoint using VueJs

Your Answer

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