<?php

require "vendor/autoload.php";
// include the class we want to use
require "../../api/Events.php";
$gen = new \PHP2WSDL\PHPClass2WSDL("Events", "http://localhost:8080/wsdl");
$gen->generateWSDL();
echo $gen->dump();
Example #2
0
<?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());
Example #3
0
File: api.php Project: rbello/ent
include_once BASE . "api/{$api}.php";
// On recherche l'implémentation
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 {