SOAP Server - Headers

Répondre
Superleseb
Superleseb
Déconnecté
Si t'es fier d'être un Nazebroke, tape dans tes mains !!
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()
  1. <?php
  2.    class fournisseursDispo { 
  3.       private $id; 
  4.       private $libelle; 
  5.       
  6.       function __construct($id, $lib) { 
  7.          $this->id = $id; 
  8.          $this->libelle = $lib; 
  9.       } 
  10.    } 
  11.  
  12.    class Search { 
  13.       private $client, $header = array(); 
  14.  
  15.       function __construct(){ 
  16.          $options = array( 
  17.             "trace"         => true, 
  18.             "exceptions"   => 0, 
  19.             "encoding"      => "utf-8", 
  20.             "compression"   => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9, 
  21.          ); 
  22.          $this->client = new SoapClient("fichier.wsdl", $options); 
  23.          
  24.          $head["RelatesTo"]   = "id:123456789"; 
  25.          $head["CallbackTo"]   = "http://url.com/here.php"; 
  26.          foreach($head as $k => $v){ 
  27.             $this->header[]   = new SoapHeader('http://test/middle', $k, $v, false); 
  28.          } 
  29.          // $this->client->__setSoapHeaders($this->header);
  30.  
  31.          $dispo = new fournisseursDispo(); 
  32.          $this->client->__soapCall("fournisseursDispo", array($dispo), null, $this->header, $this->header); 
  33.    } 
  34.    
  35.    $s = new Search();   // RECHERCHE VERS LE SERVEUR
  36.    var_dump($s);  
  37. ?> 



_ Ma page "serveur.php" qui est a
  1. <?php
  2.    // Désactivation du cache WSDL
  3.       ini_set("soap.wsdl_cache_enabled", "0"); 
  4.    
  5.    // Variables
  6.       $urlSoap = "./fichier.wsdl"; 
  7.       $options = array("soap_version" => SOAP_1_2); 
  8.    
  9.    // PARAMETRES POUR LA CLASSE
  10.       $param = "TITI"; 
  11.    
  12.    // Catch l'erreur si l'instanciation la classe SoapServer échoue, on retourne l'erreur
  13.       $soapServer   = new SoapServer($urlSoap, $options); 
  14.       $soapServer->setClass('MySearch', $param); 
  15.       $soapServer->setPersistence(SOAP_PERSISTENCE_SESSION); 
  16.       if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
  17.          $soapServer->handle(); 
  18.       } 
  19.       
  20.       class MySearch 
  21.       { 
  22.          private $header; 
  23.          
  24.          // Constructeur
  25.          function __construct($param) { 
  26.             $this->header = $param; 
  27.          } 
  28.          
  29.          // Renvoi un résultat
  30.          function fournisseursDispo($search) 
  31.          { 
  32.             global $soapServer; 
  33.             
  34.             // RECUPERATION des HEADERS DU CLIENT ICI....
  35.             $head = array();   // <------ ... (?) ... file_get_contents("php://input") --> Marche pas !
  36.             foreach($head as $k => $v) { 
  37.                $soapServer->addSoapHeader(new SoapHeader('http://test/middle', $k, $v)); 
  38.             } 
  39.             
  40.             // ...
  41.             
  42.             return $val; 
  43.          } 
  44.          
  45.          // ...
  46.       }  
  47. ?> 


Merci par avance.
Répondre
Accès rapide :

Remonter Remonter
Jamma Play - L'éditeur javascript - CSS - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique