Les fonctionnalits natives de web services Dolibarr sont places dans le rpertoire webservices
This commit is contained in:
parent
d7341f59e0
commit
747008a2fe
@ -20,56 +20,56 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/webservices_client.php
|
||||
\file htdocs/webservices/client.php
|
||||
\brief Page demo client appel WebServices Dolibarr
|
||||
\version $Revision$
|
||||
*/
|
||||
*/
|
||||
|
||||
require_once("./master.inc.php");
|
||||
require_once("../master.inc.php");
|
||||
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
|
||||
|
||||
$WS_DOL_URL = $dolibarr_main_url_root.'/webservices.php';
|
||||
$WS_METHOD = 'getVersions';
|
||||
|
||||
// Set the parameters to send to the WebService
|
||||
$parameters = array("param1"=>"value1");
|
||||
|
||||
// Set the WebService URL
|
||||
dolibarr_syslog("Create soapclient for URL=".$WS_DOL_URL);
|
||||
$soapclient = new soapclient($WS_DOL_URL);
|
||||
if ($soapclient)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Call the WebService method and store its result in $result.
|
||||
dolibarr_syslog("Call method ".$WS_METHOD);
|
||||
$result = $soapclient->call($WS_METHOD,$parameters);
|
||||
|
||||
// Show page with result
|
||||
|
||||
$WS_DOL_URL = $dolibarr_main_url_root.'/webservices/server.php';
|
||||
$WS_METHOD = 'getVersions';
|
||||
|
||||
// Set the parameters to send to the WebService
|
||||
$parameters = array("param1"=>"value1");
|
||||
|
||||
// Set the WebService URL
|
||||
dolibarr_syslog("Create soapclient for URL=".$WS_DOL_URL);
|
||||
$soapclient = new soapclient($WS_DOL_URL);
|
||||
if ($soapclient)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Call the WebService method and store its result in $result.
|
||||
dolibarr_syslog("Call method ".$WS_METHOD);
|
||||
$result = $soapclient->call($WS_METHOD,$parameters);
|
||||
|
||||
// Show page with result
|
||||
header("Content-type: text/html; charset=utf8");
|
||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
|
||||
echo '<html>'."\n";
|
||||
echo '<head>';
|
||||
echo '<title>WebService Test: '.$WS_METHOD.'</title>';
|
||||
echo '</head>'."\n";
|
||||
|
||||
echo '<body>'."\n";
|
||||
|
||||
echo "<h2>Question</h2>";
|
||||
echo '<h4>Function</h4>';
|
||||
echo $WS_METHOD;
|
||||
echo '<h4>Request</h4>';
|
||||
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo "<h2>Réponse</h2>";
|
||||
echo '<h4>Result</h4>';
|
||||
echo '<pre>';
|
||||
print_r($result);
|
||||
echo '<html>'."\n";
|
||||
echo '<head>';
|
||||
echo '<title>WebService Test: '.$WS_METHOD.'</title>';
|
||||
echo '</head>'."\n";
|
||||
|
||||
echo '<body>'."\n";
|
||||
|
||||
echo "<h2>Question</h2>";
|
||||
echo '<h4>Function</h4>';
|
||||
echo $WS_METHOD;
|
||||
echo '<h4>Request</h4>';
|
||||
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo "<h2>Réponse</h2>";
|
||||
echo '<h4>Result</h4>';
|
||||
echo '<pre>';
|
||||
print_r($result);
|
||||
echo '</pre>';
|
||||
echo '<h4>Response</h4>';
|
||||
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo '</body>'."\n";;
|
||||
echo '<h4>Response</h4>';
|
||||
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo '</body>'."\n";;
|
||||
echo '</html>'."\n";;
|
||||
?>
|
||||
?>
|
||||
@ -20,30 +20,47 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/webservices.php
|
||||
\file htdocs/webservices/server.php
|
||||
\brief Fichier point entrée des WebServices Dolibarr
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once("./master.inc.php");
|
||||
require_once("../master.inc.php");
|
||||
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
|
||||
|
||||
|
||||
|
||||
dolibarr_syslog("Call Dolibarr webservices interfaces");
|
||||
|
||||
// Create the soap Object
|
||||
$s = new soap_server;
|
||||
|
||||
// Register a method available for clients
|
||||
$s->register('getVersions');
|
||||
// Create the soap Object
|
||||
$server = new soap_server();
|
||||
$ns='dolibarr';
|
||||
$server->configureWSDL('WebServicesDolibarr',$ns);
|
||||
$server->wsdl->schemaTargetNamespace=$ns;
|
||||
|
||||
|
||||
// Register methods available for clients
|
||||
/*
|
||||
$server->register('getVersions',
|
||||
array(), // Tableau parametres entrée
|
||||
array('result' => 'xsd:array'), // Tableau parametres sortie
|
||||
$ns);
|
||||
*/
|
||||
|
||||
$server->register('getVersions',
|
||||
// Tableau parametres entrée
|
||||
array(),
|
||||
// Tableau parametres sortie
|
||||
array('dolibarr'=>'xsd:string','mysql'=>'xsd:string','apache'=>'xsd:string'),
|
||||
$ns);
|
||||
|
||||
|
||||
|
||||
// Return the results.
|
||||
$s->service($HTTP_RAW_POST_DATA);
|
||||
|
||||
|
||||
$server->service($HTTP_RAW_POST_DATA);
|
||||
|
||||
|
||||
// Full methods code
|
||||
function getVersions()
|
||||
{
|
||||
dolibarr_syslog("Function: getVersions");
|
||||
Loading…
Reference in New Issue
Block a user