|
||||
Coverage | |||||||||||||
Classes | Functions / Methods | Lines | |||||||||||
Total |
|
0.00% | 0 / 1 |
|
75.00% | 3 / 4 | CRAP |
|
71.43% | 10 / 14 | |||
Soap |
|
0.00% | 0 / 1 |
|
75.00% | 3 / 4 |
|
71.43% | 10 / 14 | ||||
initClient($params) |
|
100.00% | 1 / 1 | 1 |
|
100.00% | 2 / 2 | ||||||
call($method, $params) |
|
100.00% | 1 / 1 | 2 |
|
100.00% | 6 / 6 | ||||||
initServer($params) |
|
100.00% | 1 / 1 | 1 |
|
100.00% | 2 / 2 | ||||||
register($class) |
|
0.00% | 0 / 1 | 2 |
|
0.00% | 0 / 4 |
1 : <?php 2 : /** 3 : * Fitxer que defineix la clase protocol 4 : * @package WSFW 5 : */ 6 : 7 : /** 8 : * Soap defineix la clase que implementa el protocol SOAP 9 : * @var object $soap Objectes SoapClient/soap_server 10 : */ 11 : class Soap extends WSFW_Protocol { 12 : 13 : private $soap; 14 : 15 : /** 16 : * Inicialitza el client 17 : * Defineix la URL i crea els objectes necessaris per la connexió 18 : * @param estructura $params Parametres del client (URL) 19 : */ 20 : public function initClient($params) { 21 7 : $this->soap = new SoapClient($params["url"], array("trace"=> 1, "exceptions"=> 1)); 22 7 : } 23 : 24 : /** 25 : * Crida a un mètode del WS 26 : * @param string $method Nom del mètode 27 : * @param estructura $params Paràmetres de la crida 28 : */ 29 : public function call($method, $params) { 30 6 : if (strstr($method, ".")) // Call a servicios de métodos de clases 31 6 : $response = $this->soap->__SoapCall($method, $params); 32 : else 33 1 : $response = $this->soap->$method($params); // Call a servicios de funciones 34 6 : debug("Call $method request", $this->soap->__getLastRequest()); 35 6 : debug("Call $method response", $this->soap->__getLastResponse()); 36 6 : return objectToArray($response); 37 : } 38 : 39 : /** 40 : * Inicialitza el servidor i crea els objectes necessaris 41 : * @param estructura $params Paràmetres del servidor 42 : */ 43 : public function initServer($params) { 44 1 : $this->soap = new SoapServer($params["wsdl"]); 45 1 : } 46 : 47 : /** 48 : * Registra els serveis i crea els objectes necessaris per inicialitzar el servidor 49 : * @param object $class Instància de la classe del programador 50 : */ 51 : public function register($class) { 52 0 : $request = file_get_contents('php://input'); 53 0 : $this->soap->setClass(get_class($class)); 54 0 : $this->soap->handle($request); 55 0 : } 56 : 57 : } 58 : 59 : ?> |
Generated by PHP_CodeCoverage 1.0.3 using PHP 5.3.3-7 and PHPUnit 3.5.5 at Tue Jan 25 2:17:13 CET 2011. |