Web services are in UTF8

This commit is contained in:
Laurent Destailleur 2009-03-09 21:08:32 +00:00
parent 0c0402110e
commit a27af6c433
3 changed files with 17 additions and 18 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,10 +17,10 @@
*/ */
/** /**
\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 $Id$ * \version $Id$
*/ */
// This is to make Dolibarr working with Plesk // This is to make Dolibarr working with Plesk
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
@ -39,7 +39,7 @@ dol_syslog("Create soapclient_nusoap for URL=".$WS_DOL_URL);
$soapclient = new soapclient_nusoap($WS_DOL_URL); $soapclient = new soapclient_nusoap($WS_DOL_URL);
if ($soapclient) if ($soapclient)
{ {
$soapclient->soap_defencoding='UTF-8';
} }
// Call the WebService method and store its result in $result. // Call the WebService method and store its result in $result.
@ -56,18 +56,18 @@ echo '</head>'."\n";
echo '<body>'."\n"; echo '<body>'."\n";
echo "<h2>Question</h2>"; echo "<h2>Request</h2>";
echo '<h4>Function</h4>'; echo '<h4>Function</h4>';
echo $WS_METHOD; echo $WS_METHOD;
echo '<h4>Request</h4>'; echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>'; echo '<pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>';
echo "<h2>Réponse</h2>"; echo "<h2>Response</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>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>'; echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
echo '</body>'."\n";; echo '</body>'."\n";;

View File

@ -34,11 +34,11 @@ dol_syslog("Call Dolibarr webservices interfaces");
// Create the soap Object // Create the soap Object
$server = new soap_server(); $server = new soap_server();
$server->soap_defencoding='UTF-8';
$ns='dolibarr'; $ns='dolibarr';
$server->configureWSDL('WebServicesDolibarr',$ns); $server->configureWSDL('WebServicesDolibarr',$ns);
$server->wsdl->schemaTargetNamespace=$ns; $server->wsdl->schemaTargetNamespace=$ns;
// Register methods available for clients // Register methods available for clients
/* /*
$server->register('getVersions', $server->register('getVersions',
@ -48,7 +48,7 @@ $ns);
*/ */
$server->register('getVersions', $server->register('getVersions',
// Tableau parametres entr<EFBFBD>e // Tableau parametres entree
array(), array(),
// Tableau parametres sortie // Tableau parametres sortie
array('dolibarr'=>'xsd:string','mysql'=>'xsd:string','apache'=>'xsd:string'), array('dolibarr'=>'xsd:string','mysql'=>'xsd:string','apache'=>'xsd:string'),
@ -64,13 +64,13 @@ $server->service($HTTP_RAW_POST_DATA);
function getVersions() function getVersions()
{ {
dol_syslog("Function: getVersions"); dol_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'; $versions_array['apache']='NA';
return $versions_array; return $versions_array;
} }

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="dolibarr" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="dolibarr"> <definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="dolibarr" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="dolibarr">
<types><xsd:schema targetNamespace="dolibarr" <types><xsd:schema targetNamespace="dolibarr">
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema> </xsd:schema>