Ejemplo n.º 1
0
function resolveLSID($l)
{
    global $config;
    $rdf = '';
    $xml = '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
    $xml .= "<result>\n";
    $xml .= "<lsid>" . $l . "</lsid>\n";
    $lsid = new LSID($l);
    $proxy = '';
    if ($config['proxy_name'] != '') {
        $proxy = $config['proxy_name'] . ":" . $config['proxy_port'];
    }
    $authority = new Authority($proxy);
    $ok = false;
    if (!$lsid->isValid()) {
        $xml .= "<error>LSID is not validly formed</error>\n";
    } else {
        $ok = $authority->Resolve($l);
        if (!$ok) {
            $xml .= "<error>DNS lookup for " . $lsid->getAuthority() . " failed</error>\n";
        } else {
            $authority->GetAuthorityWSDL();
            $ok = $authority->GetHTTPBinding();
            if (!$ok) {
                $xml .= "<error>No HTTP binding found</error>\n";
            }
            $ok = $authority->GetServiceWSDL($l);
            if (!$ok) {
                $xml .= "<error>Error retrieving service WSDL</error>";
            } else {
                $authority->GetMetadataHTTPLocation();
                $rdf = $authority->GetHTTPMetadata($l);
                $ok = $rdf != '';
            }
        }
    }
    if ($ok) {
        return $rdf;
    } else {
        $xml .= "<error_codes" . " HTTP=\"" . $authority->http_code . "\"" . " LSID=\"" . $authority->lsid_code . "\"" . " CURL=\"" . $authority->curl_code . "\"" . " />\n";
        $xml .= "</result>\n";
        return $xml;
    }
}