Manuels
Divers
SOAP Server - Headers
Bonjour, j'ai un problème avec le SOAP en PHP.
Je n'arrive pas à récupérer les "headers" envoyés par mon client SOAP, DEPUIS ma page "serveur.php" pour pouvoir les traiter et les renvoyer au client.
PROBLEME à la ligne 35 de "serveur.php".
_ J'ai ma page "client.php" qui utilise la fonction SoapClient()
_ Ma page "serveur.php" qui est a
Merci par avance.
Je n'arrive pas à récupérer les "headers" envoyés par mon client SOAP, DEPUIS ma page "serveur.php" pour pouvoir les traiter et les renvoyer au client.
PROBLEME à la ligne 35 de "serveur.php".
_ J'ai ma page "client.php" qui utilise la fonction SoapClient()
- <?php
- class fournisseursDispo {
- private $id;
- private $libelle;
- function __construct($id, $lib) {
- $this->id = $id;
- $this->libelle = $lib;
- }
- }
- class Search {
- private $client, $header = array();
- function __construct(){
- $options = array(
- "trace" => true,
- "exceptions" => 0,
- "encoding" => "utf-8",
- "compression" => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9,
- );
- $this->client = new SoapClient("fichier.wsdl", $options);
- $head["RelatesTo"] = "id:123456789";
- $head["CallbackTo"] = "http://url.com/here.php";
- foreach($head as $k => $v){
- $this->header[] = new SoapHeader('http://test/middle', $k, $v, false);
- }
- // $this->client->__setSoapHeaders($this->header);
- $dispo = new fournisseursDispo();
- $this->client->__soapCall("fournisseursDispo", array($dispo), null, $this->header, $this->header);
- }
- $s = new Search(); // RECHERCHE VERS LE SERVEUR
- var_dump($s);
- ?>
_ Ma page "serveur.php" qui est a
- <?php
- // Désactivation du cache WSDL
- ini_set("soap.wsdl_cache_enabled", "0");
- // Variables
- $urlSoap = "./fichier.wsdl";
- $options = array("soap_version" => SOAP_1_2);
- // PARAMETRES POUR LA CLASSE
- $param = "TITI";
- // Catch l'erreur si l'instanciation la classe SoapServer échoue, on retourne l'erreur
- $soapServer = new SoapServer($urlSoap, $options);
- $soapServer->setClass('MySearch', $param);
- $soapServer->setPersistence(SOAP_PERSISTENCE_SESSION);
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $soapServer->handle();
- }
- class MySearch
- {
- private $header;
- // Constructeur
- function __construct($param) {
- $this->header = $param;
- }
- // Renvoi un résultat
- function fournisseursDispo($search)
- {
- global $soapServer;
- // RECUPERATION des HEADERS DU CLIENT ICI....
- $head = array(); // <------ ... (?) ... file_get_contents("php://input") --> Marche pas !
- foreach($head as $k => $v) {
- $soapServer->addSoapHeader(new SoapHeader('http://test/middle', $k, $v));
- }
- // ...
- return $val;
- }
- // ...
- }
- ?>
Merci par avance.
Accès rapide :
Remonter 

