Exemplo n.º 1
1
 public function sendSoapRequest($message)
 {
     $client = new nusoap_client(HOTEL_ENDPOINT, false);
     $client->setCredentials(USERNAME, PASSWORD);
     $result = $client->send($message, HOTEL_ENDPOINT);
     return json_encode($result);
 }
 /**
  * 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;
 }
Exemplo n.º 3
0
function connectToVPSServer($vps_node)
{
    global $pro_mysql_vps_server_table;
    $q = "SELECT * FROM {$pro_mysql_vps_server_table} WHERE hostname='{$vps_node}';";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n != 1) {
        die("Cannot find hostname {$vps_node} of VPS server line " . __LINE__ . " file " . __FILE__);
    }
    $a = mysql_fetch_array($r);
    $port = 8089;
    $soap_client = new nusoap_client("https://{$vps_node}:{$port}/");
    $err = $soap_client->getError();
    if ($err) {
        echo "Error: " . $err;
        return false;
    }
    $soap_client->setCredentials($a["soap_login"], $a["soap_pass"]);
    $err = $soap_client->getError();
    if ($err) {
        echo "Error: " . $err;
        return false;
    }
    return $soap_client;
}
Exemplo n.º 4
0
function getHotelResultsJson($location, $num_adults, $checkin_date, $checkout_date, $num_rooms = 1)
{
    $message = file_get_contents(dirname(__FILE__) . "/sample_requests/HotelSearchAvailabilityReqNew.xml");
    $message = str_replace("{TARGET_BRANCH}", TARGET_BRANCH, $message);
    $message = str_replace("{LOCATION}", $location, $message);
    $message = str_replace("{NUM_ADULTS}", $num_adults, $message);
    $message = str_replace("{CHECKIN_DATE}", $checkin_date, $message);
    $message = str_replace("{CHECKOUT_DATE}", $checkout_date, $message);
    $message = str_replace("{NUM_ROOMS}", $num_rooms, $message);
    $client = new nusoap_client(HOTEL_ENDPOINT, false);
    $client->setCredentials(USERNAME, PASSWORD);
    $result = $client->send($message, HOTEL_ENDPOINT);
    return json_encode($result);
}
Exemplo n.º 5
0
 *	Payload: document/literal
 *	Transport: http
 *	Authentication: none
 */
require_once '../lib/nusoap.php';
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$parser = xml_parser_create('');
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$prGetQuickQuotesoxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$proxyhost = "thehangar.crm.dynamics.com";
$proxyusername = "******";
$proxypassword = "******";
$client = new nusoap_client('https://thehangar.crm.dynamics.com/XRMServices/2011/OrganizationData.svc/?wsdl', 'wsdl');
$client->setCredentials($proxyusername, $proxypassword, 'realm');
$err = $client->getError();
if ($err) {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
// Doc/lit parameters get wrapped
//$param = array('Symbol' => 'IBM');
// echo "<pre>";
// var_dump($client); exit();
$result = $client->call('', array('parameters' => $param), '', '', false, true);
// Check for a fault
if ($client->fault) {
    echo '<h2>Fault</h2><pre>';
    print_r($result);
    echo '</pre>';
} else {
Exemplo n.º 6
0
require_once '../lib/nusoap.php';
$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';
echo 'You must set your username and password in the source';
exit;
$client = new nusoap_client("http://staging.mappoint.net/standard-30/mappoint.wsdl", 'wsdl', $proxyhost, $proxyport, $proxyusername, $proxypassword);
$err = $client->getError();
if ($err) {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
$client->setUseCurl($useCURL);
$client->loadWSDL();
$client->setCredentials($username, $password, 'digest');
$result = $client->call('GetVersionInfo', array());
// 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
        echo '<h2>Result</h2><pre>';
Exemplo n.º 7
0
<com:CityOrAirport Code="LON" />
</air:SearchOrigin>
<air:SearchDestination>
<com:CityOrAirport Code="AMS" />
</air:SearchDestination>
<air:SearchDestination>
<com:CityOrAirport Code="CPH" />
</air:SearchDestination>
<air:SearchDepTime PreferredTime="2014-04-15" />
</air:SearchAirLeg>
<air:AirSearchModifiers>
<air:PreferredProviders>
<com:Provider Code="1G" />
</air:PreferredProviders>
</air:AirSearchModifiers>
<com:SearchPassenger Code="ADT" />
</air:LowFareSearchReq>
</soapenv:Body>
</soapenv:Envelope>
EOM;
$client = new nusoap_client($endpoint, false);
$client->setCredentials($username, $password);
$result = $client->send($message, $endpoint);
file_put_contents("data/lowfaresearch_resp.json_08mar", json_encode($result));
//echo '<h2>Request</h2>';
//echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
//echo '<h2>Response</h2>';
//echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
//echo '<h2>Debug</h2>';
//echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
Exemplo n.º 8
0
$WS_SDS_PAGE = 1;
$WS_SDS_PAGE_SIZE = 20;
$WS_SDS_PAGINATOR_MAX_LINKS = 12;
$WS_CODIGO_FILIAL = '';
$WS_CODIGO_ESTOQUE = '';
// - - - - - - - - - - - - - - - - - - -
// Instância do WS_SDS
// - - - - - - - - - - - - - - - - - - -
require $NUSOAP_PATCH;
$WS_SDS = new nusoap_client($WS_SDS_PATCH, true);
$WS_SDS_ERROR = $WS_SDS->getError();
if ($WS_SDS_ERROR) {
    echo '<h2>Erro na construção: </h2><pre>' . $WS_SDS_ERROR . '</pre>';
    exit;
}
$WS_SDS->setCredentials($WS_SDS_USER, $WS_SDS_KEY);
// - - - - - - - - - - - - - - - - - - -
// Funçoes de apoio
// - - - - - - - - - - - - - - - - - - -
function MakePager()
{
    $get = '?';
    $pages = array();
    global $WS_SDS_PAGES_TOTAL, $WS_SDS_PAGE, $WS_SDS_PAGINATOR_MAX_LINKS;
    if (isset($_GET['pp'])) {
        unset($_GET['pp']);
    }
    foreach (array_keys($_GET) as $param) {
        $get .= $param . "=" . urlencode($_GET[$param]) . '&';
    }
    if ($WS_SDS_PAGE != 1) {
Exemplo n.º 9
0
# adiciona a lib Nusoap
require 'nusoap/nusoap.php';
# nome da instância do cliente (ex: grupox)
$owner = '{instancia}';
// alterar
$ws_user = '******';
// alterar
$ws_pass = '******';
// alterar
# cria a conexão com o webservice
$ws = new nusoap_client('http://' . $owner . '.smartdealer.com.br/webservice/core.php?wsdl', true);
# configuração
#$ws->soap_defencoding = 'UTF-8';
#$ws->decode_utf8 = true;
# autentica o usuário
$login = $ws->setCredentials($ws_user, $ws_pass);
# verifica os erros
if ($err_msg = $ws->getError()) {
    die('um erro ocorreu: ' . $err_msg);
}
/* LEITURA DOS VEÍCULOS NOVOS */
# configura o método
$call = 'CarrosNovos';
# seta os parâmetros
$elem = array('pp' => 1, 'qtd_por_pp' => 10);
$param = array('parametrospage' => $elem);
# efetua a chamada ao webservice (método CarrosNovos)
$return = $ws->call($call, $param);
if ($err_msg = $ws->getError() or !is_array($return)) {
    die('um erro ocorreu: ' . $err_msg . ' : ' . $return);
}
Exemplo n.º 10
0
function set_soap_clent($ws_remote_url, $ws_wsdl_file, $user, $password)
{
    $remote_url = parse_url($ws_remote_url);
    $soapclient = new nusoap_client($remote_url['scheme'] . '://' . ($user && $password ? $user . ":" . $password . "@" : '') . $remote_url['host'] . ':' . $remote_url['port'] . "/" . $remote_url['path'] . '/' . $ws_wsdl_file, true);
    $soapclient->setCredentials($user, $password, 'basic');
    $soapclient->useHTTPPersistentConnection();
    return $soapclient;
}
Exemplo n.º 11
0
<title>client</title>
<meta charset="utf-8">
<?php 
require_once 'clases/lib/nusoap.php';
ini_set("soap.wsdl_cache_enabled", "0");
$username = '******';
$password = '******';
$client = new nusoap_client("http://{$_SERVER['HTTP_HOST']}/ws/server.php?wsdl", 'wsdl');
#$client = new nusoap_client("http://{$_SERVER['HTTP_HOST']}/ws/server.php?wsdl",false);
$client->setCredentials($username, $password, 'basic');
#$client->soap_defencoding = 'UTF-8';
#$client->decode_utf8 = false;
$result = $client->call('Citas.ping', array());
#$result = $client->call('Citas.getSolicitante',array('nacionalidad' => 'V','cedula' => '18161508'));
#$result = $client->call('Citas.getCitasActivas',array('fecha_cita' => '2016-03-01'));
#$result = $client->call('Citas.getCitasCanceladas',array('fecha_cancelacion' => '2015-11-12'));
if ($client->fault) {
    echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>';
    print_r($result);
    echo '</pre>';
} else {
    $err = $client->getError();
    if ($err) {
        echo '<h2>Error</h2><pre>' . $err . '</pre>';
    } else {
        echo '<h2>Resultado</h2><pre>';
        var_dump($result);
        echo '</pre>';
    }
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
Exemplo n.º 12
0
    </head>
    <body>
        <?php 
# adiciona a lib Nusoap
require './nusoap/nusoap.php';
# nome da instância do cliente (ex: grupox)
$owner = '{instancia}';
// alterar
$login = '******';
// alterar
$passw = '{senha}';
// alterar
# cria a conexão com o webservice
$WS_SDS = new nusoap_client('http://' . $owner . '.smartdealer.com.br/webservice/core.php?wsdl', true);
# autentica o usuário
$WS_SDS->setCredentials($login, $passw);
// seta o usuário e senha da autenticação HTTP
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
echo '<h1>Exemplo de consumo do M&eacute;todo "GetFiliais"</h1>';
# Chamada do Método
$out = $WS_SDS->call('GetFiliais');
# Saída em Array
echo '<pre>';
print_r($out);
echo '</pre>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
echo '<h1>Exemplo de consumo do M&eacute;todo "CarrosNovos" (Apenas ve&iacute;culos novos)</h1>';