Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezxmlrpcserver.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezxmlrpcserver.php 9718 2002-08-28 09:07:16Z jb $
5 //
6 // Definition of eZXMLRPCServer class
7 //
8 // B�rd Farstad <bf@ez.no>
9 // Created on: <16-Dec-2000 10:37:45 bf>
10 //
11 // This source file is part of Exponential Basic, publishing software.
12 // Copyright (C) 1999-2000 eZ systems as
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
29
32
66 // eZXMLRPC error messages
67 define( "EZXMLRPC_NO_DOM_PARSER", -1 );
68
69 // include_once( "ezxmlrpc/classes/ezxmlrpcfunction.php" );
70 // include_once( "ezxmlrpc/classes/ezxmlrpcresponse.php" );
71 // include_once( "ezxmlrpc/classes/ezxmlrpccall.php" );
72
73 // datatypes
74 // include_once( "ezxmlrpc/classes/ezxmlrpcstring.php" );
75 // include_once( "ezxmlrpc/classes/ezxmlrpcint.php" );
76 // include_once( "ezxmlrpc/classes/ezxmlrpcbool.php" );
77 // include_once( "ezxmlrpc/classes/ezxmlrpcdouble.php" );
78 // include_once( "ezxmlrpc/classes/ezxmlrpcbase64.php" );
79 // include_once( "ezxmlrpc/classes/ezxmlrpcdatetime.php" );
80
81 class eZXMLRPCServer
82 {
86 function __construct( )
87 {
88 global $HTTP_RAW_POST_DATA;
89 $this->RawPostData = $HTTP_RAW_POST_DATA;
90 }
91
96 function processRequest()
97 {
98 global $HTTP_SERVER_VARS;
99
100 if ( $HTTP_SERVER_VARS["REQUEST_METHOD"] != "POST" )
101 {
102 print( "Error: this web page does only understand POST methods" );
103 exit();
104 }
105
106 $call = new eZXMLRPCCall( );
107 $call->decodeStream( $this->RawPostData );
108
109 $functionWasFound = false;
110 $equalParameterCount = true;
111 foreach ( $this->FunctionList as $function )
112 {
113 if ( $function->name() == $call->methodName() )
114 {
115 $func = $function->name();
116
117 if ( function_exists( $func ) )
118 {
119 $functionWasFound = true;
120
121 if ( count( $call->parameterList() ) ==
122 count( $function->parameters() ) )
123 {
124 $result = $func( $call->parameterList() );
125 }
126 else
127 {
128 $equalParameterCount = false;
129 }
130 }
131 else
132 {
133 print( "Error: could not find function" );
134 }
135 }
136 }
137
138 if ( is_a( $result, "eZXMLRPCResponse" ) )
139 {
140 $response =& $result;
141 }
142 else
143 {
144 // do the server response
145 $response = new eZXMLRPCResponse( );
146
147 if ( $functionWasFound == false )
148 {
149 $response->setError( 1, "Requested function not found." );
150 }
151
152 if ( $equalParameterCount == false )
153 {
154 $response->setError( 2, "Wrong parameter count for requested function." );
155 }
156
157 $response->setResult( $result );
158 }
159
160 $payload =& $response->payload();
161
162 Header("Server: eZ xmlrpc server" );
163 Header("Content-type: text/xml" );
164 Header( "Content-Length: " . strlen( $payload ) );
165
166 ob_end_clean();
167
168 print( $payload );
169 }
170
176 function registerFunction( $name, $params=array() )
177 {
178 $func = new eZXMLRPCFunction( $name );
179
180 foreach ( $params as $param )
181 {
182 $func->addParameter( $param );
183 }
184
185 $this->FunctionList[] = $func;
186 }
187
188
190 var $RawPostData;
191
193 var $FunctionList;
194
196 // var $MethodName;
197
198 // /// The last method request parameter list
199 // var $ParameterList;
200 }
201
202
203 ?>
eZXMLRPCCall
Definition: ezxmlrpccall.php:40
eZXMLRPCFunction
Definition: ezxmlrpcfunction.php:37
eZXMLRPCResponse
Definition: ezxmlrpcresponse.php:50
eZXMLRPCServer
Definition: ezxmlrpcserver.php:82
eZXMLRPCServer\registerFunction
registerFunction( $name, $params=array())
Definition: ezxmlrpcserver.php:176
eZXMLRPCServer\__construct
__construct()
Definition: ezxmlrpcserver.php:86
eZXMLRPCServer\$FunctionList
$FunctionList
Contains a list over registered functions.
Definition: ezxmlrpcserver.php:193
eZXMLRPCServer\processRequest
processRequest()
Definition: ezxmlrpcserver.php:96
eZXMLRPCServer\$RawPostData
$RawPostData
contains the raw HTTP post data
Definition: ezxmlrpcserver.php:190
$result
$result
Definition: companysearch.php:94
$name
$name
Definition: companytypelist.php:194
exit
exit
Definition: folder.php:81
$response
while(!feof($socket)) $response
Definition: paypalnotify.php:196
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.