I want to give one example for the order of commands if you want to use a class in persistence mode.
<?php
// 1. class definition or include
class UserService
{
public function __construct() { }
}
// 2. start the session after defining or including the class!!
session_start();
// 3. instanciate the server
$server = new SoapServer(null, array("something"));
// 4. set the class to use
$server->setClass('UserService');
// 5. set persistance mode
$server->setPersistence(SOAP_PERSISTENCE_SESSION);
// 6. handle the request
$server->handle();
?>