Exemple #1
0
//
// With the PhpWsdlProxy class I try to get around the problem, but
// complex type return values must be returned with PHPs SoapVar
// object then. Primitive return types like string, int or boolean don't
// need a special handling.
// To get rid of the NULL problem you need to ensure that the PHP
// SoapServer has no knowledge of the WSDL. To ensure this, set the
// PhpWsdl::$UseProxyWsdl property to FALSE (is FALSE per default).
//
// If you want to mix class and global methods, you need to use the proxy.
// Include the demonstration classes
require_once 'class.soapdemo.php';
require_once 'class.complextypedemo.php';
// Initialize the PhpWsdl class
require_once 'class.phpwsdl.php';
PhpWsdlMethod::$DefaultException = 'SoapFault';
// This will set SoapFault as exception type for all methods
PhpWsdl::$UseProxyWsdl = true;
// Comment this line out to get rid of "Missing parameter" exceptions and to use the method "AnotherDemoMethod" exported by the class "SecondClass"
$soap = PhpWsdl::CreateInstance(null, null, './cache', array('class.soapdemo.php', 'class.complextypedemo.php', __FILE__), null, null, null, false, false);
// Don't start the SOAP server right now
// Disable caching for demonstration
ini_set('soap.wsdl_cache_enabled', 0);
// Disable caching in PHP
PhpWsdl::$CacheTime = 0;
// Disable caching in PhpWsdl
// Run the SOAP server
if ($soap->IsWsdlRequested()) {
    $soap->Optimize = false;
}
// Don't optimize WSDL to send it human readable to the browser