/** * Parse WSDL to get namespaces * @param string $urlwdsl * @return string -> wdsl namespaces */ function rcommond_wdsl_parser($urlwdsl) { $contents = ''; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $urlwdsl); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); $contents = curl_exec($curl); curl_close($curl); $result = rcommon_xml2array($contents); //foreach to look in the array for key=definitios foreach ($result as $key => $value) { $pos = strpos($key, 'definitions'); if ($pos !== false) { break; } } return $result[$key]['attr']['targetNamespace']; }
function UserAuthentication($post_data) { global $CFG; $retAut->Codigo = '-101'; $retAut->Descripcion = 'Usuari/contrasenya errònies'; $post = rcommon_xml2array($post_data); if ($CFG->debugmode) { /// save log registering the xml received headers add_to_log(2, '2-10', serialize(rcommond_findarrayvalue($post, array("Envelope", "Header", "WSEAuthenticateHeader"))), true); } $keys = array("Envelope", "Header", "WSEAuthenticateHeader", "User", "value"); if ($valor = rcommond_findarrayvalue($post, $keys)) { $keys = array("Envelope", "Header", "WSEAuthenticateHeader", "User", "value"); $user_pub = rcommond_findarrayvalue($post, $keys); $keys = array("Envelope", "Header", "WSEAuthenticateHeader", "Password", "value"); $pwr_pub = rcommond_findarrayvalue($post, $keys); /// save log with request headers data $data_to_log->user = $user_pub; $data_to_log->pwd = $pwr_pub; add_to_log(2, 11, serialize($data_to_log)); if ($creden_usr = get_record_sql("select * from {$CFG->prefix}lms_ws_credentials where username = '******' and password = '******'")) { $retAut->Codigo = $creden_usr->code; $retAut->Descripcion = $creden_usr->description; } } /// save log with headers auth return add_to_log(2, 21, serialize($retAut)); return $retAut; }