I have a class that I want to make accessible to a web service. This
class does some work in its constructor method and sets some class
variables in its various methods. The problem I am having is creating
an instance of this class when it is called via SOAP. I don't seem to
have access to the constructor method or any class variables... is this
by design? Must all methods be static? Here is my sample code:
This is a very dumbed down sample of the class. Please don't say it
would be easier to just use static methods, the actual class is far
more complex.
Class User {
public $user_id;
public $email;
public function __construct($user_id) {
$this->user_id = $user_id;
$this->email = $this->get_user_email($user_id)
}
public function get_user_email($user_id) {
//blah blah, do some work and return email
}
}
I am currently accessing this class using:
$user = new SoapClient("http://localhost/ws/user.wsdl");
And I can get this to work to call any static methods in the class,
however I would like to be able to create the user object and then
access $user->email. Is this possible?