To do this, the
soapclient class (without the underscore character) must be instantiated, and then the
getProxy() method creates the proxy class. The code implements this for the demo service from the previous example. Note the URL of the WSDL file: It's the Web Service's URL plus
?wsdl appended to the end; change the URL accordingly for your system.
Consuming the Web Service with NuSOAP
<?php require_once 'nusoap.php'; $soap = new soapclient('http://localhost/ wsdl-nusoap-server.php?wsdl', true); $proxy = $soap->getProxy(); $result = $proxy->add(47, 11); echo "47 + 11 = $result"; ?>
?wsdl to the URL to get the WSDL description of a Web Service is an idea borrowed from Microsoft .NET. However, there the appendix is not case sensitive, whereas NuSOAP requires it to be in lowercase letters. Keep this in mind when working cross-platform.
On some systems, NuSOAP has problems when PHP is configured as a common gateway interface (CGI), not as a module built in to the web server. You then see strange paths in the WSDL file.updated