function process($source_id, $pmb_user_id, $json_input)
 {
     global $charset;
     global $wsdl;
     global $class_path;
     $the_source = $this->connector_object->instantiate_source_class($source_id);
     if (!isset($the_source->config["exported_functions"])) {
         $this->return_error("Source wasn't configured");
     }
     $allowed_methods = array();
     foreach ($the_source->config["exported_functions"] as $aallowed_method) {
         $allowed_methods[] = $aallowed_method['group'] . '_' . $aallowed_method['name'];
     }
     $json_operation = '';
     $request = $json_input;
     if ($request) {
         $json_operation = $request["method"];
     }
     //Instantions la classe qui contient les fonctions
     $ess = new external_services(true);
     if ($json_operation && $ess->operation_need_messages($json_operation)) {
         //Allons chercher les messages
         global $class_path;
         global $include_path;
         global $lang;
         require_once "{$class_path}/XMLlist.class.php";
         $messages = new XMLlist("{$include_path}/messages/{$lang}.xml", 0);
         $messages->analyser();
         global $msg;
         $msg = $messages->table;
     }
     if ($json_operation) {
         $proxy = $ess->get_proxy($pmb_user_id, array($json_operation));
     } else {
         $proxy = $ess->get_proxy($pmb_user_id);
     }
     $proxy->input_charset = 'utf-8';
     jsonRPCServer::handle($proxy, $allowed_methods, $json_input) or print 'No request';
 }
 function process($source_id, $pmb_user_id)
 {
     global $charset;
     global $wsdl;
     $get_wsdl = isset($wsdl);
     $the_source = $this->connector_object->instantiate_source_class($source_id);
     if (!isset($the_source->config["exported_functions"])) {
         $this->return_error("Source wasn't configured");
     }
     //Si on nous demande le wsdl, on le génère et on l'envoi
     if (isset($get_wsdl) && $get_wsdl) {
         $this->return_wsdl($the_source, 0);
     }
     //Si on ne veut pas le wsdl ou qu'on ne demande rien de soap, alors on ne fait rien
     if (!isset($_SERVER["HTTP_SOAPACTION"]) || !$_SERVER["HTTP_SOAPACTION"]) {
         die;
     }
     //L'url du wsdl dépend de l'url courante, et on rajoute le ?wsdl
     $wsdl_location = curPageURL();
     $wsdl_location .= strpos($wsdl_location, "?") === false ? "?wsdl" : "&wsdl";
     //Pas de cache, ça nuit au developpement
     ini_set("soap.wsdl_cache_enabled", $the_source->config["cache_wsdl"] ? 1 : 0);
     //Récupérons à partir des entêtes le nom de l'opération que l'on souhaite éxécuter.
     //Exemple d'entête:
     //	SOAPAction: "http://sigb.net/pmb/es/apisoap/pmbesZWMTest1_credential_testfunction"\r\n
     $soap_operation = substr(strrchr($_SERVER["HTTP_SOAPACTION"], "/"), 1, -1);
     if (!$soap_operation) {
         die;
     }
     //Instantions le serveur SOAP
     $this->server = new SoapServer($wsdl_location, array('encoding' => $charset, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
     //Instantions la classe qui contient les fonctions
     $ess = new external_services(true);
     if ($ess->operation_need_messages($soap_operation)) {
         //Allons chercher les messages
         global $class_path;
         global $include_path;
         global $lang;
         require_once "{$class_path}/XMLlist.class.php";
         $messages = new XMLlist("{$include_path}/messages/{$lang}.xml", 0);
         $messages->analyser();
         global $msg;
         $msg = $messages->table;
     }
     $proxy = $ess->get_proxy($pmb_user_id, array($soap_operation));
     $proxy->set_error_callback(array(&$this, "return_soapfault_from_api_exception"));
     $proxy->input_charset = 'utf-8';
     if (!method_exists($proxy, $soap_operation)) {
         $this->server->fault("unknown_method_or_bad_credentials", "Could not find the method according to your group internal's credentials");
     }
     //Donnons au serveur SOAP le proxy
     $this->server->setObject($proxy);
     //Et c'est parti!
     $this->server->handle();
 }