source: branches/version-2_11-dev/data/module/SOAP/example/server2.php @ 21318

Revision 21318, 2.2 KB checked in by kotani, 15 years ago (diff)

#1521 (PEAR::SOAP 配布と異なる部分がある)

  • 新しいバージョンの配布ファイルを上書きすることで解決

#1522 (PEAR::SOAP をバージョンアップ)

  • 0.11.0 -> 0.12.0
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
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 [email protected] so we can
12 * mail you a copy immediately.
13 *
14 * @category   Web Services
15 * @package    SOAP
16 * @author     Shane Caraveo <[email protected]>   Port to PEAR and more
17 * @author     Jan Schneider <[email protected]>       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. */
24require_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. */
36function myCallHandler($methodname, $args)
37{
38    global $soapclass;
39    return call_user_func_array(array($soapclass, $methodname), $args);
40}
41$server->setCallHandler('myCallHandler', false);
42
43require_once dirname(__FILE__) . '/example_server.php';
44$soapclass = new SOAP_Example_Server();
45$server->addObjectMap($soapclass, 'urn:SOAP_Example_Server');
46
47if (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}
Note: See TracBrowser for help on using the repository browser.