Tutorial To Install the Nusoap.php Class With Your PHP Scripts
- Forums
- PHP
- Tutorial To Install the Nusoap.php Class With Your PHP Scripts
This Support Page Will Show You The Installation Steps For Installing Nusoap.php Class In Your Scripts. Will also show you the website where you can download and then install it in your PHP script using simple PHP code. [2086], Last Updated: Mon Jun 24, 2024
Webune Support
Sun Jan 17, 2010
2 Comments
7034 Visits
if you have been following our tutorial, we need to install nusoap.php because we got the folloing error on our SOAP script:
Warning: main(nusoap.php) [function.main]: failed to open stream: No such file or directory in /var/www/testscripts/SOAP/testsoap.php on line 7
Fatal error: main() [function.require]: Failed opening required 'nusoap.php' (include_path='.;/var/www/testscripts/SOAP/testsoap.php on line 7
NuSOAP is a rewrite of SOAPx4, provided by NuSphere and Dietrich Ayala. It is a set of PHP classes - no PHP extensions required - that allow developers to create and consume web services based on SOAP 1.1, WSDL 1.1 and HTTP 1.0/1.1.
in my example, i was running a script called testsoap.php, this file was located in my web directory at: /var/www/testscripts/SOAP/testsoap.php and to open this file, the url was: http://localhost/testscripts/SOAP/testsoap.php
follow these steps to install nusoap.php
1. Donwnload the current version. The current version at this momment is: nusoap-0.7.3.zip (175.9 KB)
download: http://sourceforge.net/projects/nusoap/
2. once you have downloaded the zip file, extract all the files in the same directory where you are running your script from. in my example, the PHP file is testsoap.php which is located in my directory: /var/www/testscripts/SOAP/ so i will extract it in the SOAP/ folder (if you have windows server, the probably might look like this: C:\inetpub\wwwroot\testscripts)
3. you should have all two directories in the nusoap-0.7.3 Directory:
./lib
changelog
class.nusoap_base.php
class.soapclient.php
class.soap_fault.php
class.soap_parser.php
class.soap_server.php
class.soap_transport_http.php
class.soap_val.php
class.wsdl.php
class.wsdlcache.php
class.xmlschema.php
nusoap.php
nusoapmime.php
./samples
.....
im not going to list the samples file, but as you can see from the lib directory, we have a file called nusoap.php so now go we edit our script and change:
from:
require('nusoap.php');
to:
require('nusoap-0.7.3/lib/nusoap.php');
save the changes and try again your script, now you shouldn't get the error: Fatal error: main() [function.require]: Failed opening required 'nusoap.php'
fatal error: uncaught soapfault exception: [wsdl] soap-error: parsing wsdl: couldn't load from 'localhost/testscripts/soap/stockserver.php' in c:\apachefriends\xampp\htdocs\testscripts\soap\stockclient.php:4 stack trace: #0 c:\apachefriends\xampp\htdocs\testscripts\soap\stockclient.php(4): soapclient->__construct('localhos...') #1 {main} thrown in c:\apachefriends\xampp\htdocs\testscripts\soap\stockclient.php on line 4