itop.wsdl.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. // Copyright (C) 2010-2012 Combodo SARL
  3. //
  4. // This file is part of iTop.
  5. //
  6. // iTop is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // iTop is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU Affero General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with iTop. If not, see <http://www.gnu.org/licenses/>
  18. /**
  19. * Dynamic generation of the WSDL file for SOAP Web services
  20. *
  21. * @copyright Copyright (C) 2010-2012 Combodo SARL
  22. * @license http://opensource.org/licenses/AGPL-3.0
  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. require_once(APPROOT.'application/utils.inc.php');
  47. // Load the modules installed and enabled
  48. //
  49. require_once(APPROOT.'/application/startup.inc.php');
  50. require_once(APPROOT.'webservices/webservices.basic.php');
  51. if (isset($_REQUEST['service_category']) && (!empty($_REQUEST['service_category'])))
  52. {
  53. $sRawFile = WebServicesBase::GetWSDLContents($_REQUEST['service_category']);
  54. }
  55. else
  56. {
  57. $sRawFile = WebServicesBase::GetWSDLContents();
  58. }
  59. $sServerURI = utils::GetAbsoluteUrlAppRoot().'webservices/soapserver.php';
  60. if (isset($_REQUEST['service_category']) && (!empty($_REQUEST['service_category'])))
  61. {
  62. $sServerURI .= "?service_category=".$_REQUEST['service_category'];
  63. }
  64. $sFinalFile = str_replace(
  65. '___SOAP_SERVER_URI___',
  66. $sServerURI,
  67. $sRawFile
  68. );
  69. echo $sFinalFile;
  70. ?>