diff --git a/htdocs/webservices/demo_wsclient_invoice.php b/htdocs/webservices/demo_wsclient_invoice.php index dce3e472271..8c12040a6dd 100755 --- a/htdocs/webservices/demo_wsclient_invoice.php +++ b/htdocs/webservices/demo_wsclient_invoice.php @@ -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 "
\n\n"; + print $soapclient1->request; + print "
\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 "
\n\n"; + print $soapclient2->request; + print "
\n\n"; + print $soapclient2->response; + exit; } diff --git a/htdocs/webservices/demo_wsclient_other.php b/htdocs/webservices/demo_wsclient_other.php index d51ae578805..28f60558729 100755 --- a/htdocs/webservices/demo_wsclient_other.php +++ b/htdocs/webservices/demo_wsclient_other.php @@ -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 "
\n\n"; + print $soapclient->request; + print "
\n\n"; + print $soapclient->response; exit; } diff --git a/htdocs/webservices/demo_wsclient_thirdparty.php b/htdocs/webservices/demo_wsclient_thirdparty.php index 302dfd0dc1e..41358055420 100755 --- a/htdocs/webservices/demo_wsclient_thirdparty.php +++ b/htdocs/webservices/demo_wsclient_thirdparty.php @@ -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 "
\n\n"; + print $soapclient->request; + print "
\n\n"; + print $soapclient->response; exit; } diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 224ef7203f1..0bc7e988720 100755 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -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; diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 1f6b9635e24..da37bdd30ac 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -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; diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 993a40e6c28..a843aee3c56 100755 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -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; diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 65c15d04897..496f18ebc9a 100755 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -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;