downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SoapServer::setObject> <SoapServer::handle
Last updated: Fri, 14 Aug 2009

view this page in

SoapServer::setClass

(PHP 5 >= 5.0.1)

SoapServer::setClassConfigure la classe qui sera utilisée pour gérer les requêtes SOAP

Description

public void SoapServer::setClass ( string $class_name [, string $args ] )

Exporte toute les méthodes de la classe spécifiée.

SoapServer::setClass() configure une classe qui servira de gestionnaire aux requêtes SOAP. L'objet pourra alors être rendu persistant à travers les requêtes pour une session PHP, avec la méthode SoapServer::setPersistence().

Liste de paramètres

class_name

Le nom de la classe exportée.

args

Ces paramètres optionnels seront passé par défaut au constructeur de la classe, durant la phase de création de l'objet.

Valeurs de retour

Aucune valeur n'est retournée.

Voir aussi



SoapServer::setObject> <SoapServer::handle
Last updated: Fri, 14 Aug 2009
 
add a note add a note User Contributed Notes
SoapServer::setClass
Matt
03-Jul-2009 03:25
As expected, using SoapServer::setClass() on a class with private or protected methods does not expose those methods.

Calling a private/protected method from the SoapClient causes this: E_ERROR "Call to protected method my_class::myPrivateMethod() from context"
christiaan at oakfox dot net
04-May-2009 11:21
You can also retrieve object properties the following way while using __autoload($class_name).

<?php

# Start Session
session_start();

# Auto Load Class as Required
function __autoload($class_name)
{
    require_once
"/var/www/example/class/". $class_name. ".php";
}

//service

$_SESSION[_bogus_session_name] = unserialize($_SESSION[_bogus_session_name]);
$server = new SoapServer('service.wsdl');
$server->setClass("MyClass");
$server->setPersistence(SOAP_PERSISTENCE_SESSION);
$server->handle();
$_SESSION[_bogus_session_name] = serialize($_SESSION[_bogus_session_name])

?>
Ariz Jacinto
05-Dec-2008 12:38
If you want your SOAP client to be able to save and then retrieve the object properties, you need to set the SOAP server to be persistent by setting session.auto_start=0, invoking session_start(), and SoapServer->setPersistence(SOAP_PERSISTENCE_SESSION) in the following manner:

<?php
 
//set ini
 
ini_set("soap.wsdl_cache_enabled", 0);
 
ini_set("session.auto_start", 0);

 
//class file
 
require_once('MyClass.php');

 
//for persistent session
 
session_start();

 
//service
 
$server = new SoapServer('service.wsdl');
 
$server->setClass("MyClass");
 
$server->setPersistence(SOAP_PERSISTENCE_SESSION);
 
$server->handle();
?>
info at adaniels dot nl
07-Mar-2008 12:46
A method SoapServer::setObject($object) also exists. This is for some reason not documented.

SoapServer::setObject> <SoapServer::handle
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites