SOAP
[ class tree: SOAP ] [ index: SOAP ] [ all elements ]

Source for file server2.php

Documentation is available at server2.php

  1. <?php
  2. /**
  3.  * Server endpoint.
  4.  *
  5.  * PHP versions 4 and 5
  6.  *
  7.  * LICENSE: This source file is subject to version 2.02 of the PHP license,
  8.  * that is bundled with this package in the file LICENSE, and is available at
  9.  * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
  10.  * did not receive a copy of the PHP license and are unable to obtain it
  11.  * through the world-wide-web, please send a note to license@php.net so we can
  12.  * mail you a copy immediately.
  13.  *
  14.  * @category   Web Services
  15.  * @package    SOAP
  16.  * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more
  17.  * @author     Jan Schneider <jan@horde.org>       Maintenance
  18.  * @copyright  2003-2007 The PHP Group
  19.  * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
  20.  * @link       http://pear.php.net/package/SOAP
  21.  */
  22.  
  23. /* First, include the SOAP_Server class. */
  24. require_once 'SOAP/Server.php';
  25. $server = new SOAP_Server;
  26.  
  27. /* Tell server to translate to classes we provide if possible. */
  28. $server->_auto_translation = true;
  29.  
  30. /* This is a simple example of implementing a custom call handler.  If you do
  31.  * this, the SOAP server will ignore objects or functions added to it, and
  32.  * will call your handler for **ALL** SOAP calls the server receives, whether
  33.  * the call is defined in your WSDL or not.  The handler receives two
  34.  * arguments, the method name being called, and the arguments sent for that
  35.  * call. */
  36. function myCallHandler($methodname$args)
  37. {
  38.     global $soapclass;
  39.     return call_user_func_array(array($soapclass$methodname)$args);
  40. }
  41. $server->setCallHandler('myCallHandler'false);
  42.  
  43. require_once dirname(__FILE__'/example_server.php';
  44. $soapclass = new SOAP_Example_Server();
  45. $server->addObjectMap($soapclass'urn:SOAP_Example_Server');
  46.  
  47. if (isset($_SERVER['REQUEST_METHOD']&&
  48.     $_SERVER['REQUEST_METHOD'== 'POST'{
  49.     $server->service($HTTP_RAW_POST_DATA);
  50. else {
  51.     require_once 'SOAP/Disco.php';
  52.     $disco = new SOAP_DISCO_Server($server'ServerExample');
  53.     header('Content-type: text/xml');
  54.     if (isset($_SERVER['QUERY_STRING']&&
  55.        strpos($_SERVER['QUERY_STRING']'wsdl'!== false{
  56.         echo $disco->getWSDL();
  57.     else {
  58.         echo $disco->getDISCO();
  59.     }
  60. }

Documentation generated on Mon, 04 Aug 2008 20:00:30 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.