Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
NuSOAP - how to integrate into Fuel
  • Is it possible to integrate NuSoap library into Fuel framework without changes? Or I need to convert it into package or something like that?
  • Julian Esperat wrote on Tuesday 11th of October 2011:
    I think NuSoap can generate WSDL files, which the native SOAP extension is unable to do. The easiest would be to put NuSoap into app/vendor directory and edit the bootstrap to include the appropriate autoload.
    If you create a package you'll need to update the package each time NuSoap releases an update if you want to keep everything clean. So keeping the original NuSoap source code as it is in a separate "vendor" directory is not a bad idea. Alternatively, the package could just do the same: configure the autoloader and keep the whole original NuSoap source code as it is in the package. Up to you.

    You can easily create wsdl with Eclipse IDE. NuSoap is dead library ... but is's your choice
  • Last I looked it had been dead for years, but I see they released a new version last year. Any reason to use it over PHP's native SOAP extension? Converting into a package is often a good idea, another way is to just put it somewhere and load it as its docs describe (often requires an extra autoloader belonging to the library). The convetion we use in the core is to put it into a vendor dir, so for your app you'd put it into app/vendor/nusoap for example.
  • I think NuSoap can generate WSDL files, which the native SOAP extension is unable to do. The easiest would be to put NuSoap into app/vendor directory and edit the bootstrap to include the appropriate autoload.
    If you create a package you'll need to update the package each time NuSoap releases an update if you want to keep everything clean. So keeping the original NuSoap source code as it is in a separate "vendor" directory is not a bad idea. Alternatively, the package could just do the same: configure the autoloader and keep the whole original NuSoap source code as it is in the package. Up to you.
  • I'll go with app/vendor solution.. Thanks to both of you.
  • Ok, I'm stucked.. I've put complete nusoap lib to ./fuel/app/vendor/NuSoap/, and edited ./fuel/app/bootstrap.php:
    Autoloader::add_classes(array(
     'NuSoap' => APPPATH.'vendor/NuSoap/nusoap.php',
    ));
    

    And in test controler have this:
    $client = new nusoap_client("http://soap.amazon.com/onca/soap2", false);
    

    but that throws me an error: ErrorException [ Error ]: Class 'nusoap_client' not found I feel I need to do something else, or I'm calling nusoap_client incorrectly.. Any idea?
  • You've told our autoloader where to find the NuSoap class, how would it now where to find "nusoap_client"? Check out the NuSoap docs, it'll probably explain how to load it in a way that makes its classes available to you.
  • I'm doing same way as in NuSoap docs.. There was an example like this
    require_once('lib/nusoap.php');
    $soap_client = new nusoap_client('http://something.com', true);
    

    Still trying to figure it out, thanks
  • Adding something to the autoloader won't load it, it only tells the autoloader where to find the class when you request it. NuSoap works outside Fuel's normal loading, I'd advice you to just use require to load it when you need it.
  • Ahh, that makes sense.. just added this:
    require_once(APPPATH.'vendor/NuSoap/nusoap.php');
    
    and now it works.. Thanks
  • I've extended base.php and modified "import" method to support loading app vendor classes.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion