Fix: Parameter pb.

This commit is contained in:
Laurent Destailleur 2011-03-18 10:08:36 +00:00
parent a47dc64f8f
commit f80ac7f8f9
7 changed files with 42 additions and 10 deletions

View File

@ -29,8 +29,10 @@ require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php';
//$WS_DOL_URL = 'http://localhost:8080/'; // If not a page, should end with /
$WS_METHOD1 = 'getInvoice';
$WS_METHOD2 = 'getInvoicesForThirdParty';
$ns='http://www.dolibarr.org/ns/';
// Set the WebService URL
@ -39,11 +41,13 @@ $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.
@ -56,20 +60,28 @@ $authentication=array(
$parameters = array('authentication'=>$authentication,'id'=>1,'ref'=>'');
dol_syslog("Call method ".$WS_METHOD1);
$result1 = $soapclient1->call($WS_METHOD1,$parameters);
$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;
}
$parameters = array('authentication'=>$authentication,'idthirdparty'=>'1');
dol_syslog("Call method ".$WS_METHOD2);
$result2 = $soapclient2->call($WS_METHOD2,$parameters);
$result2 = $soapclient2->call($WS_METHOD2,$parameters,$ns,'');
if (! $result2)
{
print $soapclient2->error_str;
exit;
print $soapclient2->error_str;
print "<br>\n\n";
print $soapclient2->request;
print "<br>\n\n";
print $soapclient2->response;
exit;
}

View File

@ -29,7 +29,9 @@ require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php';
//$WS_DOL_URL = 'http://localhost:8080/'; // If not a page, should end with /
$WS_METHOD = 'getVersions';
$ns='http://www.dolibarr.org/ns/';
// Set the WebService URL
@ -38,6 +40,7 @@ $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
// Call the WebService method and store its result in $result.
@ -49,10 +52,16 @@ $authentication=array(
'entity'=>'');
$parameters = array('authentication'=>$authentication);
dol_syslog("Call method ".$WS_METHOD);
$result = $soapclient->call($WS_METHOD,$parameters);
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
if (! $result)
{
//var_dump($soapclient);
//print_r($soapclient);
print $soapclient->error_str;
print "<br>\n\n";
print $soapclient->request;
print "<br>\n\n";
print $soapclient->response;
exit;
}

View File

@ -29,7 +29,9 @@ require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php';
//$WS_DOL_URL = 'http://localhost:8080/'; // If not a page, should end with /
$WS_METHOD = 'getThirdParty';
$ns='http://www.dolibarr.org/ns/';
// Set the WebService URL
@ -38,6 +40,7 @@ $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
// Call the WebService method and store its result in $result.
@ -47,12 +50,16 @@ $authentication=array(
'login'=>'admin',
'password'=>'changeme',
'entity'=>'');
$parameters = array('authentication'=>$authentication,'id'=>0,'name'=>'aaa');
$parameters = array('authentication'=>$authentication,'id'=>0,'name'=>'aaa','ref_ext'=>'');
dol_syslog("Call method ".$WS_METHOD);
$result = $soapclient->call($WS_METHOD,$parameters);
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
if (! $result)
{
print $soapclient->error_str;
print "<br>\n\n";
print $soapclient->request;
print "<br>\n\n";
print $soapclient->response;
exit;
}

View File

@ -46,6 +46,7 @@ if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
// Create the soap Object
$server = new nusoap_server();
$server->soap_defencoding='UTF-8';
$server->decode_utf8=false;
$ns='http://www.dolibarr.org/ns/';
$server->configureWSDL('WebServicesDolibarrInvoice',$ns);
$server->wsdl->schemaTargetNamespace=$ns;
@ -191,7 +192,7 @@ $ns
/**
* Get invoice from id, ref or ref_ext
*/
function getInvoice($authentication,$id,$ref,$ref_ext)
function getInvoice($authentication,$id='',$ref='',$ref_ext='')
{
global $db,$conf,$langs;

View File

@ -46,6 +46,7 @@ if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
// Create the soap Object
$server = new nusoap_server();
$server->soap_defencoding='UTF-8';
$server->decode_utf8=false;
$ns='http://www.dolibarr.org/ns/';
$server->configureWSDL('WebServicesDolibarrOther',$ns);
$server->wsdl->schemaTargetNamespace=$ns;

View File

@ -46,6 +46,7 @@ if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
// Create the soap Object
$server = new nusoap_server();
$server->soap_defencoding='UTF-8';
$server->decode_utf8=false;
$ns='http://www.dolibarr.org/ns/';
$server->configureWSDL('WebServicesDolibarrSupplierInvoice',$ns);
$server->wsdl->schemaTargetNamespace=$ns;
@ -193,7 +194,7 @@ $ns
/**
* Get invoice from id, ref or ref_ext
*/
function getSupplierInvoice($authentication,$id,$ref,$ref_ext)
function getSupplierInvoice($authentication,$id='',$ref='',$ref_ext='')
{
global $db,$conf,$langs;

View File

@ -46,6 +46,7 @@ if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
// Create the soap Object
$server = new nusoap_server();
$server->soap_defencoding='UTF-8';
$server->decode_utf8=false;
$ns='http://www.dolibarr.org/ns/';
$server->configureWSDL('WebServicesDolibarrThirdParty',$ns);
$server->wsdl->schemaTargetNamespace=$ns;
@ -125,7 +126,7 @@ $ns
// Full methods code
function getThirdParty($authentication,$id,$ref,$ref_ext)
function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
{
global $db,$conf,$langs;