Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
71578693
Commit
71578693
authored
12 years ago
by
Jean-François Ferry
Browse files
Options
Downloads
Patches
Plain Diff
New webservice for order with method to get, create and valid an order
parent
d9d01c80
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/webservices/demo_wsclient_order.php-NORUN
+141
-0
141 additions, 0 deletions
htdocs/webservices/demo_wsclient_order.php-NORUN
htdocs/webservices/server_order.php
+778
-0
778 additions, 0 deletions
htdocs/webservices/server_order.php
with
919 additions
and
0 deletions
htdocs/webservices/demo_wsclient_order.php-NORUN
0 → 100755
+
141
−
0
View file @
71578693
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/webservices/demo_wsclient_order.php
* \brief Demo page to make a client call to Dolibarr WebServices "server_order"
*/
// This is to make Dolibarr working with Plesk
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once '../master.inc.php';
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_order.php';
//$WS_DOL_URL = 'http://localhost:8080/'; // To test with Soapui mock. If not a page, should end with /
$WS_METHOD1 = 'getOrder';
$WS_METHOD2 = 'getOrdersForThirdParty';
$ns='http://www.dolibarr.org/ns/';
// Set the WebService URL
dol_syslog("Create nusoap_client for URL=".$WS_DOL_URL);
$soapclient1 = new nusoap_client($WS_DOL_URL);
if ($soapclient1)
{
$soapclient1->soap_defencoding='UTF-8';
$soapclient1->decodeUTF8(false);
}
$soapclient2 = new nusoap_client($WS_DOL_URL);
if ($soapclient2)
{
$soapclient2->soap_defencoding='UTF-8';
$soapclient2->decodeUTF8(false);
}
// Call the WebService method and store its result in $result.
$authentication=array(
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'changeme',
'entity'=>'');
// Test url 1
if ($WS_METHOD1)
{
$parameters = array('authentication'=>$authentication,'id'=>1,'ref'=>'');
dol_syslog("Call method ".$WS_METHOD1);
$result1 = $soapclient1->call($WS_METHOD1,$parameters,$ns,'');
if (! $result1)
{
print $soapclient1->error_str;
print "<br>\n\n";
print $soapclient1->request;
print "<br>\n\n";
print $soapclient1->response;
exit;
}
}
// Test url 2
if ($WS_METHOD2)
{
$parameters = array('authentication'=>$authentication,'idthirdparty'=>'4');
dol_syslog("Call method ".$WS_METHOD2);
$result2 = $soapclient2->call($WS_METHOD2,$parameters,$ns,'');
if (! $result2)
{
print $soapclient2->error_str;
print "<br>\n\n";
print $soapclient2->request;
print "<br>\n\n";
print $soapclient2->response;
exit;
}
}
/*
* View
*/
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_METHOD1.'</title>';
echo '</head>'."\n";
echo '<body>'."\n";
echo 'NUSOAP_PATH='.NUSOAP_PATH.'<br>';
echo "<h2>Request:</h2>";
echo '<h4>Function</h4>';
echo $WS_METHOD1;
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient1->request, ENT_QUOTES) . '</pre>';
echo '<hr>';
echo "<h2>Response:</h2>";
echo '<h4>Result</h4>';
echo '<pre>';
print_r($result1);
echo '</pre>';
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient1->response, ENT_QUOTES) . '</pre>';
print '<hr>';
echo "<h2>Request:</h2>";
echo '<h4>Function</h4>';
echo $WS_METHOD2;
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient2->request, ENT_QUOTES) . '</pre>';
echo '<hr>';
echo "<h2>Response:</h2>";
echo '<h4>Result</h4>';
echo '<pre>';
print_r($result2);
echo '</pre>';
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient2->response, ENT_QUOTES) . '</pre>';
echo '</body>'."\n";;
echo '</html>'."\n";;
?>
This diff is collapsed.
Click to expand it.
htdocs/webservices/server_order.php
0 → 100644
+
778
−
0
View file @
71578693
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment