Re: Working is classes(objects)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David wrote:
Hi Mark,

Mark McCulligh wrote:

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?


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

I have try adding "$server->setPersistence(SOAP_PERSISTENCE_SESSION);" just above the handle line and it did change my results. Is there something in my php.ini file I have to change or on the client side.

Thanks,
Mark.

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux