php soap sessions
| From: | SirDariuszS | Date: | Tue, 27 Mar 2007 17:24:37 +0000 |
| Subject: | php soap sessions | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2490@lists.php.net to get a copy of this message | ||
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*)
?>