Re: [SOAP] Working is classes(objects)
| From: | Mark McCulligh | Date: | Mon, 19 Jun 2006 18:21:57 +0000 |
| Subject: | Re: [SOAP] Working is classes(objects) | ||
| References: | 1 2 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-2320@lists.php.net to get a copy of this message | ||
David wrote:
Hi Mark, Mark McCulligh wrote:I get it to work using presistence. I had a typo. Thanks David for your help. Mark.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) {What you are missing is persistence, you could save the variable in a file / database, or keep the class in your session with http://nl2.php.net/manual/nl/function.soap-soapserver-setpersistence.php Kind regards, David$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?