CValue::setSession("_date_min", $_date_min); CValue::setSession("_date_max", $_date_max); CValue::setSession("fonction", $fonction); $doc_errors_msg = $doc_errors_ack = ""; // Chargement de l'échange SOAP demandé $echange_soap = new CEchangeSOAP(); $echange_soap->load($echange_soap_id); if ($echange_soap->_id) { $echange_soap->loadRefs(); $echange_soap->input = unserialize($echange_soap->input); if ($echange_soap->soapfault != 1) { $echange_soap->output = unserialize($echange_soap->output); } } // Récupération de la liste des echanges SOAP $itemEchangeSoap = new CEchangeSOAP(); $where = array(); if ($_date_min && $_date_max) { $echange_soap->_date_min = $_date_min; $echange_soap->_date_max = $_date_max; $where['date_echange'] = " BETWEEN '" . $_date_min . "' AND '" . $_date_max . "' "; } if ($service) { $where['type'] = " = '" . $service . "'"; } if ($fonction) { $where['function_name'] = " = '" . $fonction . "'"; } if ($web_service) { $where["web_service_name"] = " = '" . $web_service . "'"; }
<?php /** * Download exchange * * @category Webservices * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ $echange_soap_id = CValue::get("echange_soap_id"); $echange_soap = new CEchangeSOAP(); $echange_soap->load($echange_soap_id); $echange_soap->loadRefs(); $input = print_r(unserialize($echange_soap->input), true); if ($echange_soap->soapfault == 1) { $output = print_r($echange_soap->output, true); } else { $output = print_r(unserialize($echange_soap->output), true); } $function_name = $echange_soap->function_name; $content = "Date d'echange :\n{$echange_soap->date_echange}\n\nTemps de reponse :\n{$echange_soap->response_time} ms \n\nParametres :\n\n{$input}\nResultat :\n\n{$output}\n"; if (CAppUI::conf("webservices trace")) { $content .= "Entete requete :\n\n {$echange_soap->last_request_headers}\n\n Requete :\n\n {$echange_soap->last_request}\n\n Entete reponse :\n\n {$echange_soap->last_response_headers}\n\n Reponse :\n\n {$echange_soap->last_response}\n"; } $echange = utf8_decode($content); header("Content-Disposition: attachment; filename={$function_name}-{$echange_soap_id}.txt"); header("Content-Type: text/plain; charset=" . CApp::$encoding); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
/** Calls a SOAP function * * @param string $function_name The name of the SOAP function to call * @param array $arguments An array of the arguments to pass to the function * @param array $options An associative array of options to pass to the client * @param mixed $input_headers An array of headers to be sent along with the SOAP request * @param array &$output_headers If supplied, this array will be filled with the headers from the SOAP response * * @throws Exception|SoapFault * * @return mixed SOAP functions may return one, or multiple values */ public function call($function_name, $arguments, $options = null, $input_headers = null, &$output_headers = null) { $client = $this->client; if (!is_array($arguments)) { $arguments = array($arguments); } /* @todo Lors d'un appel d'une méthode RPC le tableau $arguments contient un élement vide array( [0] => ) * posant problème lors de l'appel d'une méthode du WSDL sans argument */ if (isset($arguments[0]) && empty($arguments[0])) { $arguments = array(); } if ($client->flatten && isset($arguments[0]) && !empty($arguments[0])) { $arguments = $arguments[0]; } $output = null; $echange_soap = new CEchangeSOAP(); $echange_soap->date_echange = CMbDT::dateTime(); $echange_soap->emetteur = CAppUI::conf("mb_id"); $echange_soap->destinataire = $client->wsdl_url; $echange_soap->type = $client->type_echange_soap; $url = parse_url($client->wsdl_url); $path = explode("/", $url['path']); $echange_soap->web_service_name = end($path); $echange_soap->function_name = $function_name; // Truncate input and output before storing $arguments_serialize = array_map_recursive(array('CSOAPClient', "truncate"), $arguments); $echange_soap->input = serialize($arguments_serialize); if ($client->loggable) { $echange_soap->store(); } CApp::$chrono->stop(); $chrono = new Chronometer(); $chrono->start(); try { $output = $client->call($function_name, $arguments, $options, $input_headers, $output_headers); if (!$client->loggable) { CApp::$chrono->start(); return $output; } } catch (SoapFault $fault) { // trace if (CAppUI::conf("webservices trace")) { $client->getTrace($echange_soap); } $chrono->stop(); $echange_soap->date_echange = CMbDT::dateTime(); $echange_soap->output = $fault->faultstring; $echange_soap->soapfault = 1; $echange_soap->response_time = $chrono->total; $echange_soap->store(); CApp::$chrono->start(); throw $fault; } $chrono->stop(); CApp::$chrono->start(); $echange_soap->date_echange = CMbDT::dateTime(); // trace if (CAppUI::conf("webservices trace")) { $client->getTrace($echange_soap); } // response time $echange_soap->response_time = $chrono->total; if ($echange_soap->soapfault != 1) { $echange_soap->output = serialize(array_map_recursive(array("CSOAPClient", "truncate"), $output)); } $echange_soap->store(); return $output; }
<?php /** * View exchanges * * @category Webservices * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $echange_soap_id = CValue::get("echange_soap_id"); // Chargement de l'échange SOAP demandé $echange_soap = new CEchangeSOAP(); $echange_soap->load($echange_soap_id); if ($echange_soap->_id) { $echange_soap->loadRefs(); $echange_soap->input = unserialize($echange_soap->input); if ($echange_soap->soapfault != 1) { $echange_soap->output = unserialize($echange_soap->output); } } // Création du template $smarty = new CSmartyDP(); $smarty->assign("echange_soap", $echange_soap); $smarty->display("inc_echange_soap_details.tpl");