1 | <?php |
---|
2 | /** |
---|
3 | * This file contains the code for the TCP SOAP server. |
---|
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 Tomasz Rup <tomasz.rup@gmail.com> |
---|
17 | * @copyright 2003-2005 The PHP Group |
---|
18 | * @license http://www.php.net/license/2_02.txt PHP License 2.02 |
---|
19 | * @link http://pear.php.net/package/SOAP |
---|
20 | */ |
---|
21 | |
---|
22 | /** |
---|
23 | * server base class |
---|
24 | */ |
---|
25 | require_once 'Net/Server.php'; |
---|
26 | |
---|
27 | /** |
---|
28 | * base class for the handler |
---|
29 | */ |
---|
30 | require_once 'Net/Server/Handler.php'; |
---|
31 | |
---|
32 | |
---|
33 | /** |
---|
34 | * SOAP Server Class that implements a TCP SOAP Server. |
---|
35 | * http://www.pocketsoap.com/specs/smtpbinding/ |
---|
36 | * |
---|
37 | * This class overrides the default HTTP server, providing the ability to |
---|
38 | * accept socket connections and execute SOAP calls. |
---|
39 | * |
---|
40 | * @access public |
---|
41 | * @package SOAP |
---|
42 | * @author Tomasz Rup <tomasz.rup@gmail.com> |
---|
43 | */ |
---|
44 | class SOAP_Server_TCP_Handler extends Net_Server_Handler { |
---|
45 | |
---|
46 | var $_SOAP_Server; |
---|
47 | |
---|
48 | function setSOAPServer(&$server) |
---|
49 | { |
---|
50 | $this->_SOAP_Server =& $server; |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * If the user sends data, send it back to him |
---|
55 | * |
---|
56 | * @access public |
---|
57 | * @param integer $clientId |
---|
58 | * @param string $data |
---|
59 | */ |
---|
60 | function onReceiveData($clientId = 0, $data = '') |
---|
61 | { |
---|
62 | if (trim($data) <> '') { |
---|
63 | $response = $this->_SOAP_Server->service($data); |
---|
64 | $this->_server->sendData($clientId, $response); |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | function onStart() |
---|
69 | { |
---|
70 | $this->_SOAP_Server->onStart(); |
---|
71 | } |
---|
72 | |
---|
73 | function onIdle() |
---|
74 | { |
---|
75 | $this->_SOAP_Server->onIdle(); |
---|
76 | } |
---|
77 | } |
---|