コード例 #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);
 }
コード例 #2
1
 /**
  * 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;
 }
コード例 #3
0
ファイル: vps.php プロジェクト: jeremy-cayrasso/dtc
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;
}
コード例 #4
0
ファイル: hotel_client.php プロジェクト: venkatpapana/vtravel
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);
}
コード例 #5
0
ファイル: wsdlclient1.php プロジェクト: kgatjens/crm-php
 *	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 {
コード例 #6
0
ファイル: wsdlclient7.php プロジェクト: luzma1/Laboratorio_7
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>';
コード例 #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>';
コード例 #8
0
ファイル: sds-wp-novos.php プロジェクト: smartdealer/plugins
$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) {
コード例 #9
0
ファイル: novos.php プロジェクト: smartdealer/sdpack
# 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);
}
コード例 #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;
}
コード例 #11
0
ファイル: client.php プロジェクト: mermamerma/ws
<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>';
コード例 #12
0
ファイル: todos.php プロジェクト: smartdealer/sdpack
    </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>';