Working is classes(objects)
| From: | Mark McCulligh | Date: | Mon, 19 Jun 2006 16:00:27 +0000 |
| Subject: | Working is classes(objects) | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2315@lists.php.net to get a copy of this message | ||
Hi Group,
I am new to soap and try to build my first SOAP server I cannot get the php server to remember variable I pass it. I created a simple class with two functions one to set a veraiable, the other to retieve it. when I retieve the variable it is alway blank. See below for my code.
NOTE: If add a __construct function to the class to default the var it will alway be that value, the set function will not replace it.
Server Code:
<?php
class Test_Server {
private $var_test;
public function set_var_test($var_test) {
$this->var_test = $var_test;} public function get_var_test() {
return $this->var_test;} } $server = new SoapServer("www.example.com/wsdl/test.wsdl"); $server->setClass("Test_Server"); $server->handle(); ?> Client: <?php $client = new Soapclient("www.example.com/wsdl/test.wsdl"); $client->set_var_test("Hello"); echo $client->get_var_test(); ?> What I am missing? Thanks, Mark.