php - Creating nusoap object inside Magento Event Listener throws exception -
in magento 1.7.0.2, have created event listener triggers every time application checks final price of product (the final code not trigger on event, testing convenience, trying here).
the event triggers fine , changes price accordingly, when try create nusoap object make non-wsdl calls external webservice, raises warning , not create client object.
the code is:
$endpoint = 'http://[ip]:155/[client_name]/[client_name].soap2'; try { $client = new nusoap_client($endpoint); } catch (exception $e) { echo $e->getmessage(); }
and warning raised:
warning: include(nusoap/client.php) [<a href="function.include">function.include</a>]: failed open stream: no such file or directory in /var/www/clients/client3/magento/lib/varien/autoload.php on line 93
the same code works fine if executed on magento root directory, able call correct webservice , parse response.
i have included nusoap libraries (v. 0.9.5) in magento root lib directory, , have not required them specifically.
you've identified problem
i have included nusoap libraries (v. 0.9.5) in magento root lib directory , have not required them specifically
when attempt instantiate object using nusoap_client
class, php can't find class. per standard behavior, calls magento autoloader method, converts class nusoap_client
file path nusoap/client.php
, , attempts include
file. php, per standard include
behavior, looks files at
app/code/local/nusoap/client.php app/code/community/nusoap/client.php app/code/core/nusoap/client.php lib/nusoap/client.php path/of/the/calling/script/nusoap/client.php
you don't have file @ of these locations, php raises warning. manually require nusoap
object, placed loader objects @ 1 of above paths, or add custom autoloader handles library location.
Comments
Post a Comment