forked from Wavyzz/dolibarr
Dolibarr offre des fonctions Web services nativement
This commit is contained in:
@@ -354,7 +354,8 @@ function top_htmlhead($head, $title="", $target="")
|
|||||||
//header("Content-type: text/html; charset=UTF-8");
|
//header("Content-type: text/html; charset=UTF-8");
|
||||||
header("Content-type: text/html; charset=iso-8859-1");
|
header("Content-type: text/html; charset=iso-8859-1");
|
||||||
|
|
||||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
// print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
||||||
|
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
|
||||||
print "\n<html>";
|
print "\n<html>";
|
||||||
|
|
||||||
print $langs->lang_header();
|
print $langs->lang_header();
|
||||||
@@ -393,9 +394,8 @@ function top_htmlhead($head, $title="", $target="")
|
|||||||
print '<link rel="alternate stylesheet" type="text/css" title="Yellow" href="'.DOL_URL_ROOT.'/theme/yellow/yellow.css">'."\n";
|
print '<link rel="alternate stylesheet" type="text/css" title="Yellow" href="'.DOL_URL_ROOT.'/theme/yellow/yellow.css">'."\n";
|
||||||
|
|
||||||
print '<link rel="top" title="'.$langs->trans("Home").'" href="'.DOL_URL_ROOT.'/">'."\n";
|
print '<link rel="top" title="'.$langs->trans("Home").'" href="'.DOL_URL_ROOT.'/">'."\n";
|
||||||
print '<link rel="help" title="'.$langs->trans("Help").'" href="http://www.dolibarr.com/aide.fr.html">'."\n";
|
|
||||||
print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
|
print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
|
||||||
print '<link rel="author" title="'.$langs->trans("DevelopmentTeam").'" href="http://www.dolibarr.com/dev.fr.html">'."\n";
|
print '<link rel="author" title="'.$langs->trans("DevelopmentTeam").'" href="http://www.dolibarr.org">'."\n";
|
||||||
|
|
||||||
if ($conf->use_javascript || $conf->use_ajax)
|
if ($conf->use_javascript || $conf->use_ajax)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,24 +29,33 @@ require_once("./master.inc.php");
|
|||||||
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
|
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dolibarr_syslog("Call Dolibarr webservices interfaces");
|
||||||
|
|
||||||
// Create the soap Object
|
// Create the soap Object
|
||||||
$s = new soap_server;
|
$s = new soap_server;
|
||||||
|
|
||||||
// Register a method available for clients
|
// Register a method available for clients
|
||||||
$s->register('getVersions');
|
$s->register('getVersions');
|
||||||
|
|
||||||
|
// Return the results.
|
||||||
|
$s->service($HTTP_RAW_POST_DATA);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getVersions()
|
function getVersions()
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog("Function: getVersions");
|
||||||
|
|
||||||
$versions_array=array();
|
$versions_array=array();
|
||||||
|
|
||||||
$versions_array['dolibarr']=DOL_VERSION;
|
$versions_array['dolibarr']=DOL_VERSION;
|
||||||
$versions_array['mysql']='NA';
|
$versions_array['mysql']='NA';
|
||||||
|
$versions_array['apache']='NA';
|
||||||
|
|
||||||
return $versions_array;
|
return $versions_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the results.
|
|
||||||
$s->service($HTTP_RAW_POST_DATA);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -23,53 +23,53 @@
|
|||||||
\file htdocs/webservices_client.php
|
\file htdocs/webservices_client.php
|
||||||
\brief Page demo client appel WebServices Dolibarr
|
\brief Page demo client appel WebServices Dolibarr
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once("./master.inc.php");
|
require_once("./master.inc.php");
|
||||||
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
|
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
|
||||||
|
|
||||||
$WS_DOL_URL = $dolibarr_main_url_root.'/webservices.php';
|
$WS_DOL_URL = $dolibarr_main_url_root.'/webservices.php';
|
||||||
$WS_METHOD = 'getVersions';
|
$WS_METHOD = 'getVersions';
|
||||||
|
|
||||||
// Set the parameters to send to the WebService
|
// Set the parameters to send to the WebService
|
||||||
$parameters = array("param1"=>"value1");
|
$parameters = array("param1"=>"value1");
|
||||||
|
|
||||||
// Set the WebService URL
|
// Set the WebService URL
|
||||||
dolibarr_syslog("Create soapclient for URL=".$WS_DOL_URL);
|
dolibarr_syslog("Create soapclient for URL=".$WS_DOL_URL);
|
||||||
$soapclient = new soapclient($WS_DOL_URL);
|
$soapclient = new soapclient($WS_DOL_URL);
|
||||||
if ($soapclient)
|
if ($soapclient)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the WebService method and store its result in $result.
|
// Call the WebService method and store its result in $result.
|
||||||
dolibarr_syslog("Call method ".$WS_METHOD);
|
dolibarr_syslog("Call method ".$WS_METHOD);
|
||||||
$result = $soapclient->call($WS_METHOD,$parameters);
|
$result = $soapclient->call($WS_METHOD,$parameters);
|
||||||
|
|
||||||
// Show page with result
|
// Show page with result
|
||||||
header("Content-type: text/html; charset=iso-8859-1");
|
header("Content-type: text/html; charset=utf8");
|
||||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
|
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
|
||||||
echo '<html>'."\n";
|
echo '<html>'."\n";
|
||||||
echo '<head>';
|
echo '<head>';
|
||||||
echo '<title>WebService Test: '.$WS_METHOD.'</title>';
|
echo '<title>WebService Test: '.$WS_METHOD.'</title>';
|
||||||
echo '</head>'."\n";
|
echo '</head>'."\n";
|
||||||
|
|
||||||
echo '<body>'."\n";
|
echo '<body>'."\n";
|
||||||
|
|
||||||
echo "<h2>Question</h2>";
|
echo "<h2>Question</h2>";
|
||||||
echo '<h4>Function</h4>';
|
echo '<h4>Function</h4>';
|
||||||
echo $WS_METHOD;
|
echo $WS_METHOD;
|
||||||
echo '<h4>Request</h4>';
|
echo '<h4>Request</h4>';
|
||||||
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
|
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
|
||||||
|
|
||||||
echo "<h2>Réponse</h2>";
|
echo "<h2>Réponse</h2>";
|
||||||
echo '<h4>Result</h4>';
|
echo '<h4>Result</h4>';
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
print_r($result);
|
print_r($result);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
echo '<h4>Response</h4>';
|
echo '<h4>Response</h4>';
|
||||||
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
|
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
|
||||||
|
|
||||||
echo '</body>'."\n";;
|
echo '</body>'."\n";;
|
||||||
echo '</html>'."\n";;
|
echo '</html>'."\n";;
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user