Hi,
I'm trying to implement session management with soap by calling
'server.php' from two different clients - the values should increment in
client2.php but they don't. Please help me. Thanks.
server.php:
<?php
class HelloServer {
private $count;
function __construct() {
$this->count = 0;
}
function sayhello() {
$this->count++;
return $this->count;
}
}
$options = array("uri" => "http://test-uri/");
$server = new SoapServer(NULL, $options);
$server->setClass("HelloServer");
$server->setPersistence(SOAP_PERSISTENCE_SESSION);
$server->handle();
?>
client1.php:
<?php
$option = array(
"location" => "http://localhost/phptest/server.php",
"uri" => "http://test-uri/",
"trace" => 1);
$client = new SoapClient(NULL, $option);
echo $client->sayhello() . "<br>"; // reutrns 1
echo $client->sayhello() . "<br>"; // returns 2
echo $client->sayhello() . "<br>"; // returns 3
?>
client2.php
<?php
$option = array(
"location" => "http://localhost/phptest/server.php",
"uri" => "http://test-uri/",
"trace" => 1);
$client = new SoapClient(NULL, $option);
echo $client->sayhello() . "<br>"; // reutrns 1 (*should be 4*)
echo $client->sayhello() . "<br>"; // returns 2 (*should be 5*)
echo $client->sayhello() . "<br>"; // returns 3 (*should be 6*)
?>
--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php