1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| <?php
require_once "Zend/Soap/AutoDiscover.php";
require_once "Zend/Soap/Wsdl/Strategy/ArrayOfTypeSequence.php";
require_once "Zend/Soap/Server.php";
require_once "Zend/Soap/Wsdl.php";
function debug ($var = false, $showHtml = false, $showFrom = true) {
$out = "";
if ($showFrom) {
$calledFrom = debug_backtrace();
$out .= '<strong>' . $calledFrom[0]['file'] . '</strong>';
$out .= ' (line <strong>' . $calledFrom[0]['line'] . '</strong>)';
}
$out .= "\n<pre class=\"commercio-debug\">\n";
$out .= print_r($var, true);
if ($showHtml) {
$out .= str_replace('<', '<', str_replace('>', '>', $out));
}
$out .= "\n</pre>\n";
global $request;
if ($request ['shell']) {
$out = "______________________________________________\n" . trim (strip_tags($out)) . "\n______________________________________________\n";
}
echo $out;
}
class Walk {
/**
* @var int
*/
var $Walkid;
/**
* @var string
*/
var $WalkTitle;
/**
* @var string
*/
var $WalkDate;
/**
* @var string
*/
var $WalkDescription;
}
class Walks {
/**
* @var Walk[]
*/
public $ar;
}
class Test {
/**
* @param int
* @return int
*/
public function testBasic ($val) {
return $val;
}
/**
* @param int
* @return Walks
*/
public function GetWalk($walkid)
{
return array(
"WalkId" => $walkid,
"WalkTitle" => "Title of my long walk",
"WalkDate" => date("Y-m-d", time()),
"WalkDescription" => "Really long walk description"
);
}
/**
* @return Walks
*/
public function GetWalks()
{
return array (
array(
"WalkId" => 1,
"WalkTitle" => "Title of my long walk",
"WalkDate" => date("Y-m-d", time()),
"WalkDescription" => "Really long walk description",
),
array(
"WalkId" => 2,
"WalkTitle" => "Title of my long walk",
"WalkDate" => date("Y-m-d", time()),
"WalkDescription" => "Really long walk description",
),
);
}
}
if (array_key_exists('wsdl', $_GET)) {
// Retour de la WSDL
$wsdl = new Zend_Soap_AutoDiscover("Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence");
$wsdl->setClass('Test');
$wsdl->handle();
exit ();
}
// Traitement de la requête
$server = new Zend_Soap_Server('http://' . $_SERVER ['SERVER_NAME'] . $_SERVER ['REQUEST_URI'] . '?wsdl');
$server->setOptions (array (
'encoding' => 'UTF-8',
));
$server->setClass('Test');
$server->handle();
?> |
Partager