/**
  * Permet de mettre en place le client de la requête en fonction du WSDL.
  *
  * @param $urlWsdl
  * @return \nusoap_client
  */
 private function setClientSoap($urlWsdl)
 {
     // Instanciation du client SOAP
     $this->client = new \nusoap_client($urlWsdl, false, false, false, false, false, 0, 1000);
     $this->client->soap_defencoding = 'UTF-8';
     $this->client->decode_utf8 = false;
     // Mise en place des options CURL
     // Option curl
     $this->client->setUseCurl(true);
     // Mise en place du SSl si on l'active
     if ($this->enabledSSL) {
         // Mise en place des données d'authentification SSL
         $certRequest = array('cainfofile' => $this->caChainClientLocation, 'sslcertfile' => $this->certClientLocation, 'sslkeyfile' => $this->privateKeyClientLocation, 'passphrase' => $this->privateKeyClientPassword);
         $this->client->setCredentials('', '', 'certificate', $certRequest);
         $this->client->setCurlOption(CURLOPT_SSLVERSION, 3);
         // @TODO : cette option sera à mettre à true. On utilisera un fichier contenant l'AC Yousign en tant que trustore
         $this->client->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
     }
     // @TODO : voir comment on lève une exception
     $err = $this->client->getError();
     if ($err) {
         echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
         echo '<h2>Debug</h2><pre>' . htmlspecialchars($this->client->getDebug(), ENT_QUOTES) . '</pre>';
         exit;
     }
     return $this->client;
 }
예제 #2
0
/**
 * @brief Call uBio's SOAP service to find all names that match query.
 *
 * @param Text The name to search for.
 * @param has_authority
 */
function ubio_namebank_search($text, $has_authority = false)
{
    global $config;
    global $db;
    // Maybe we have this already?
    $namebankID = find_ubio_name_in_cache($text, $has_authority);
    if (count($namebankID) > 0) {
        return $namebankID;
    }
    // Not found, so make SOAP call
    $client = new nusoap_client('http://names.ubio.org/soap/', 'wsdl', $config['proxy_name'], $config['proxy_port'], '', '');
    $err = $client->getError();
    if ($err) {
        return $names;
    }
    // This is vital to get through Glasgow's proxy server
    $client->setUseCurl(true);
    $param = array('searchName' => base64_encode($text), 'searchAuth' => '', 'searchYear' => '', 'order' => 'name', 'rank' => '', 'sci' => 1, 'linkedVern' => 1, 'vern' => 1, 'keyCode' => $config['uBio_key']);
    $proxy = $client->getProxy();
    $result = $proxy->namebank_search($param['searchName'], $param['searchAuth'], $param['searchYear'], $param['order'], $param['rank'], $param['sci'], $param['linkedVern'], $param['vern'], $param['keyCode']);
    // Check for a fault
    if ($proxy->fault) {
        //		print_r($result);
    } else {
        // Check for errors
        $err = $proxy->getError();
        if ($err) {
        } else {
            // Display the result
            print_r($result);
            if (isset($result['scientificNames'])) {
                // get the relevant matches
                foreach ($result['scientificNames'] as $r) {
                    if ($has_authority) {
                        $n = strtolower(base64_decode($r['fullNameString']));
                        // Strip punctuation
                        $n = str_replace(",", "", $n);
                        $n = str_replace("(", "", $n);
                        $n = str_replace(")", "", $n);
                        $text = str_replace(",", "", $text);
                        $text = str_replace("(", "", $text);
                        $text = str_replace(")", "", $text);
                    } else {
                        $n = strtolower(base64_decode($r['nameString']));
                    }
                    //echo $n;
                    if ($n == strtolower($text)) {
                        // Store this name
                        array_push($namebankID, $r['namebankID']);
                    }
                    // Store name in cache
                    store_ubio_name($r);
                }
            }
        }
    }
    return $namebankID;
}
 /**
  * TODO: Get Error Service and show detailed Error Message
  */
 function openmeetings_loginuser()
 {
     global $USER, $CFG;
     //		echo $CFG->openmeetings_red5host."<br/>";
     //		echo $CFG->openmeetings_red5port."<br/>";
     //
     //		echo "USER: "******"<br/>";
     //		echo "Pass: "******"<br/>";
     //echo "DIRROOT: ".$CFG->dirroot."<br/>";
     $client_userService = new nusoap_client($this->getUrl() . "/services/UserService?wsdl", "wsdl");
     $client_userService->setUseCurl(true);
     //echo "Client inited"."<br/>";
     $err = $client_userService->getError();
     if ($err) {
         echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
         echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
         exit;
     }
     $result = $client_userService->call('getSession');
     if ($client_userService->fault) {
         echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>';
         print_r($result);
         echo '</pre>';
     } else {
         $err = $client_userService->getError();
         if ($err) {
             echo '<h2>Error</h2><pre>' . $err . '</pre>';
         } else {
             //echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
             $this->session_id = $result["return"]["session_id"];
             //echo '<h2>Result</h2><pre>'; printf(); echo '</pre>';
             $params = array('SID' => $this->session_id, 'username' => $CFG->openmeetings_openmeetingsAdminUser, 'userpass' => $CFG->openmeetings_openmeetingsAdminUserPass);
             //$params = array();
             $result = $client_userService->call('loginUser', $params);
             //echo '<h2>Params</h2><pre>'; print_r($params); echo '</pre>';
             if ($client_userService->fault) {
                 echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>';
                 print_r($result);
                 echo '</pre>';
             } else {
                 $err = $client_userService->getError();
                 if ($err) {
                     echo '<h2>Error</h2><pre>' . $err . '</pre>';
                 } else {
                     //echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
                     $returnValue = $result["return"];
                     //echo '<h2>returnValue</h2><pre>'; printf($returnValue); echo '</pre>';
                 }
             }
         }
     }
     if ($returnValue > 0) {
         return true;
     } else {
         return false;
     }
 }
예제 #4
0
function _feed_stockbiz($method, $url, $params, $debug = true)
{
    global $_services;
    require_once _NUSOAP_ABSPATH_ . 'nusoap.php';
    require_once _NUSOAP_ABSPATH_ . 'class.wsdlcache.php';
    $cache = new wsdlcache(_NUSOAP_CACHE_, 0);
    $wsdl = $cache->get($url);
    if (is_null($wsdl)) {
        $wsdl = new wsdl($url);
        $cache->put($wsdl);
    } else {
        $wsdl->clearDebug();
    }
    $client = new nusoap_client($wsdl, true);
    $client->decode_utf8 = false;
    $client->setUseCurl(false);
    $result = $client->call($method, $params);
    if ($client->fault) {
        if ($debug) {
            echo '<h2>Fault</h2><pre>';
            print_r($result);
            echo '</pre>';
        }
    } else {
        if ($err = $client->getError()) {
            if ($debug) {
                echo '<h2>Error</h2><pre>' . $err . '</pre>';
            }
        } else {
            if (!empty($result)) {
                return $result;
            }
        }
    }
    return false;
}
예제 #5
0
파일: wsdlclient5.php 프로젝트: boskee/soap
        echo '<h2>WSDL Constructor error (Expect - 404 Not Found)</h2><pre>' . $err . '</pre>';
        echo '<h2>Debug</h2><pre>' . htmlspecialchars($wsdl->getDebug(), ENT_QUOTES) . '</pre>';
        exit;
    }
    $cache->put($wsdl);
} else {
    $wsdl->clearDebug();
    $wsdl->debug('Retrieved from cache');
}
$client = new nusoap_client($wsdl, 'wsdl', $proxyHost, $proxyPort, $proxyUsername, $proxyPassword);
$err = $client->getError();
if ($err) {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    exit;
}
$client->setUseCurl($useCURL);
$params = array('isbn' => '0060188782');
$result = $client->call('getPrice', $params);
// Check for a fault
if ($client->fault) {
    echo '<h2>Fault</h2><pre>';
    print_r($result);
    echo '</pre>';
} else {
    // Check for errors
    $err = $client->getError();
    if ($err) {
        // Display the error
        echo '<h2>Error</h2><pre>' . $err . '</pre>';
    } else {
        // Display the result
예제 #6
0
파일: function.php 프로젝트: pezzabros/Loki
function connectHkuSoap($url = EW_HKU_SOAP_SERVER)
{
    global $client;
    $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
    $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
    $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
    $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
    $useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
    $client = new nusoap_client($url, false, $proxyhost, $proxyport, $proxyusername, $proxypassword);
    $err = $client->getError();
    $client->setUseCurl($useCURL);
    $params = array('login' => EW_CONN_USER_HKU, 'password' => EW_CONN_PASS_HKU);
    $result = $client->call('doLogin', $params, EW_HKU_SOAP_NAMESPACE);
    //, $params, 'http://soap.amazon.com', 'http://soap.amazon.com');
    $session = $result['session'];
    // print_r($session) . '<br>';
    return $session;
}
예제 #7
0
	/**
	 * Initialize the SOAP client connection.
	 * @param String $endpoint URL to connect.
	 * @return Boolean True if the connection succeed.
	 */
	private function _connect ($endpoint, $proxyhost = null, $proxyport = null, $proxyuser = null, $proxypass = null)
	{
		if (is_null($proxyhost))
			$proxyhost = $this->_soapProxyHost;
		if (is_null($proxyport))
			$proxyport = $this->_soapProxyPort;
		if (is_null($proxyuser))
			$proxyuser = $this->_soapProxyUser;
		if (is_null($proxypass))
			$proxypass = $this->_soapProxyPass;

		$conn = new nusoap_client($endpoint, false, $proxyhost, $proxyport, $proxyuser, $proxypass);
		$err = $conn->getError();
		if ($err)
		{
                        $this->_log->logError($err);
                        $this->_log->logError($conn->getDebug());
			$this->_soapConn = null;
                        return false;
                }
		else
		{
                	$conn->setUseCurl(DEFAULT_NUSOAP_CURLREQUEST);
			$this->_soapConn = $conn;
			return true;
		}
	}
예제 #8
0
 function order_registerdomain($DomainName, $ServiceDetails, $ContactDetails)
 {
     //parametri dell'ordine
     $params = array('LoginEmail' => $this->LoginEmail, 'LoginPassword' => $this->LoginPassword, 'DomainName' => $DomainName, 'ServiceDetails' => $ServiceDetails, 'ContactDetails' => $ContactDetails);
     //Connection parameters
     //do not modify  -   non modificare
     $proxyhost = '';
     $proxyport = '';
     $proxyusername = '';
     $proxypassword = '';
     $useCURL = '0';
     $client = new nusoap_client("http://api.dominiofaidate.com/xml/Order.asmx?WSDL", true);
     $client->soap_defencoding = 'UTF-8';
     $err = $client->getError();
     if ($err) {
         echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
         echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
         exit;
     }
     $client->setUseCurl($useCURL);
     $client->useHTTPPersistentConnection();
     $result = $client->call('RegisterDomain', $params);
     if ($client->fault) {
         echo '<h2>Fault</h2><pre>';
         print_r($result);
         echo '</pre>';
     } else {
         $err = $client->getError();
         if ($err) {
             echo '<h2>Error</h2><pre>' . $err . '</pre>';
         }
     }
     return $result;
 }
예제 #9
0
/**
 * @brief Call uBio's SOAP service to find all names in text
 *
 * @param Text The text to search.
 */
function ubio_findit($text)
{
    global $config;
    $names = array();
    $client = new nusoap_client('http://names.ubio.org/soap/', 'wsdl', $config['proxy_name'], $config['proxy_port'], '', '');
    $err = $client->getError();
    if ($err) {
        return $names;
    }
    // This is vital to get through Glasgow's proxy server
    $client->setUseCurl(true);
    $param = array('url' => '', 'freeText' => base64_encode($text), 'strict' => 0, 'threshold' => 0.5);
    $proxy = $client->getProxy();
    if (!isset($proxy)) {
        return $names;
    }
    $result = $proxy->findIT($param['url'], $param['freeText'], $param['strict'], $param['threshold']);
    // Check for a fault
    if ($proxy->fault) {
        print_r($result);
    } else {
        // Check for errors
        $err = $proxy->getError();
        if ($err) {
        } else {
            // Display the result
            //print_r($result);
            // Extract names
            $xml = $result['returnXML'];
            if ($xml != '') {
                if (PHP_VERSION >= 5.0) {
                    $dom = new DOMDocument();
                    $dom->loadXML($xml);
                    $xpath = new DOMXPath($dom);
                    $xpath_query = "//allNames/entity";
                    $nodeCollection = $xpath->query($xpath_query);
                    $nameString = '';
                    foreach ($nodeCollection as $node) {
                        foreach ($node->childNodes as $v) {
                            $name = $v->nodeName;
                            if ($name == "nameString") {
                                $nameString = $v->firstChild->nodeValue;
                                $names[$nameString]['nameString'] = $v->firstChild->nodeValue;
                            }
                            if ($name == "score") {
                                $names[$nameString]['score'] = $v->firstChild->nodeValue;
                            }
                            if ($name == "namebankID") {
                                $names[$nameString]['namebankID'] = $v->firstChild->nodeValue;
                            }
                            if ($name == "parsedName") {
                                // Much grief, we need to attribute of this node
                                $n = $v->attributes->getNamedItem('canonical');
                                $names[$nameString]['canonical'] = $n->nodeValue;
                            }
                        }
                    }
                }
            }
            //print_r($names);
            //echo '</pre>';
        }
    }
    //		echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
    //		echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
    //		echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
    return $names;
}