itop.wsdl.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. // Copyright (C) 2010 Combodo SARL
  3. //
  4. // This program is free software; you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation; version 3 of the License.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. /**
  17. * Dynamic generation of the WSDL file for SOAP Web services
  18. *
  19. * @author Erwan Taloc <erwan.taloc@combodo.com>
  20. * @author Romain Quetiez <romain.quetiez@combodo.com>
  21. * @author Denis Flaven <denis.flaven@combodo.com>
  22. * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
  23. */
  24. if (isset($_REQUEST['debug']))
  25. {
  26. if ($_REQUEST['debug'] == 'text')
  27. {
  28. header('Content-Type: text/plain; charset=UTF-8');
  29. }
  30. else
  31. {
  32. header('Content-Type: application/xml; charset=UTF-8');
  33. }
  34. }
  35. else
  36. {
  37. // This is to make sure that the client will accept it....
  38. //
  39. header('Content-Type: application/xml; charset=UTF-8');
  40. ////header('Content-Disposition: attachment; filename="itop.wsdl"');
  41. header('Content-Disposition: online; filename="itop.wsdl"');
  42. }
  43. require_once('../approot.inc.php');
  44. require_once(APPROOT.'webservices/webservices.class.inc.php');
  45. require_once(APPROOT.'core/config.class.inc.php');
  46. // Load the modules installed and enabled
  47. //
  48. $oConfig = new Config(APPROOT.'config-itop.php');
  49. $aFiles = $oConfig->GetWebServiceCategories();
  50. foreach ($aFiles as $sFile)
  51. {
  52. require_once(APPROOT.$sFile);
  53. }
  54. if (isset($_REQUEST['service_category']) && (!empty($_REQUEST['service_category'])))
  55. {
  56. $sRawFile = WebServicesBase::GetWSDLContents($_REQUEST['service_category']);
  57. }
  58. else
  59. {
  60. $sRawFile = WebServicesBase::GetWSDLContents();
  61. }
  62. $sServerURI = 'http'.((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off')) ? 's' : '').'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].dirname($_SERVER['SCRIPT_NAME']).'/soapserver.php';
  63. if (isset($_REQUEST['service_category']) && (!empty($_REQUEST['service_category'])))
  64. {
  65. $sServerURI .= "?service_category=".$_REQUEST['service_category'];
  66. }
  67. $sFinalFile = str_replace(
  68. '___SOAP_SERVER_URI___',
  69. $sServerURI,
  70. $sRawFile
  71. );
  72. echo $sFinalFile;
  73. ?>