<?php require "vendor/autoload.php"; // include the class we want to use require "Events.php"; $gen = new \PHP2WSDL\PHPClass2WSDL("Events", "http://localhost:8080/soap-server2.php"); $gen->generateWSDL(); file_put_contents("wsdl", $gen->dump());
if (!class_exists("\\API\\{$api}")) { header('HTTP/1.0 500 Api Not Found'); echo "500 Api Not Available ({$api})"; exit; } $apiClass = "\\API\\{$api}"; $url = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}/api/"; // Génération du WSDL if ($dn == 'wsdl') { // TODO Vérifier la méthode (GET) //header("Content-type: application/wsdl+xml"); header("Content-type: text/xml"); // On construit la classe de conversion $wsdl = new \PHP2WSDL\PHPClass2WSDL($apiClass, "{$url}{$api}.soap"); // On lance la génération du WSDL $wsdl->generateWSDL(true); $data = $wsdl->dump(); echo $data; // Cache @file_put_contents(BASE . "system/cache/wsdl/{$api}.wsdl", $data); } else { if ($dn == 'soap') { ini_set('soap.wsdl_cache_enabled', $config['debug'] ? '0' : '1'); ini_set('soap.wsdl_cache_ttl', '86400'); ini_set('soap.wsdl_cache_dir', BASE . 'system/cache/wsdl/'); $server = new \SoapServer("{$url}{$api}.wsdl", array('trace' => $config['debug'] ? 1 : 0, 'exception' => $config['debug'] ? 1 : 0)); $server->setObject(api($api)); $server->handle(); } else { if ($dn == 'info') { header("Content-type: text/html");