server.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4 |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license, |
  9. // | that is bundled with this package in the file LICENSE, and is |
  10. // | available at through the world-wide-web at |
  11. // | http://www.php.net/license/2_02.txt. |
  12. // | If you did not receive a copy of the PHP license and are unable to |
  13. // | obtain it through the world-wide-web, please send a note to |
  14. // | license@php.net so we can mail you a copy immediately. |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Shane Caraveo <Shane@Caraveo.com> |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: server.php,v 1.8 2003/04/13 21:38:59 shane Exp $
  20. //
  21. // first, include the SOAP/Server class
  22. require_once 'SOAP/Server.php';
  23. $server = new SOAP_Server;
  24. /* tell server to translate to classes we provide if possible */
  25. $server->_auto_translation = true;
  26. require_once 'example_server.php';
  27. $soapclass = new SOAP_Example_Server();
  28. $server->addObjectMap($soapclass,'urn:SOAP_Example_Server');
  29. if (isset($_SERVER['REQUEST_METHOD']) &&
  30. $_SERVER['REQUEST_METHOD']=='POST') {
  31. $server->service($HTTP_RAW_POST_DATA);
  32. } else {
  33. require_once 'SOAP/Disco.php';
  34. $disco = new SOAP_DISCO_Server($server,'ServerExample');
  35. header("Content-type: text/xml");
  36. if (isset($_SERVER['QUERY_STRING']) &&
  37. strcasecmp($_SERVER['QUERY_STRING'],'wsdl')==0) {
  38. echo $disco->getWSDL();
  39. } else {
  40. echo $disco->getDISCO();
  41. }
  42. exit;
  43. }
  44. ?>