Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezxmlrpccall.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezxmlrpccall.php 8714 2001-12-10 12:29:48Z bf $
5 //
6 // Definition of eZXMLRPCCall class
7 //
8 // B�rd Farstad <bf@ez.no>
9 // Created on: <16-Dec-2000 11:15:16 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
36 // include_once( "ezxmlrpc/classes/ezxmlrpcdatatypedecoder.php" );
37 // include_once( "ezxml/classes/ezxml.php" );
38
39 class eZXMLRPCCall
40 {
44 function __construct( )
45 {
46 $this->clearParameters( );
47 }
48
52 function setMethodName( $name )
53 {
54 $this->MethodName = $name;
55 }
56
60 function methodName( )
61 {
62 return $this->MethodName;
63 }
64
75 function addParameter( $value )
76 {
77 $ret = false;
78 switch ( strtolower( get_class( $value ) ) )
79 {
80 case "ezxmlrpcstring" :
81 {
82 $this->ParameterList[] = $value;
83 $ret = true;
84 }
85 break;
86
87 case "ezxmlrpcint" :
88 {
89 $this->ParameterList[] = $value;
90 $ret = true;
91 }
92 break;
93
94 case "ezxmlrpcdouble" :
95 {
96 $this->ParameterList[] = $value;
97 $ret = true;
98 }
99 break;
100
101 case "ezxmlrpcarray" :
102 {
103 $this->ParameterList[] = $value;
104 $ret = true;
105 }
106 break;
107
108 case "ezxmlrpcbase64" :
109 {
110 $this->ParameterList[] = $value;
111 $ret = true;
112 }
113 break;
114
115 case "ezxmlrpcboolean" :
116 {
117 $this->ParameterList[] = $value;
118 $ret = true;
119 }
120 break;
121
122 case "ezxmlrpcstruct" :
123 {
124 $this->ParameterList[] = $value;
125 $ret = true;
126 }
127 break;
128
129 default :
130 {
131 if ( $value != "Object" )
132 {
133 // include_once( "ezxmlrpc/classes/ezxmlrpcstring.php" );
134
135 $string = new eZXMLRPCString( $value );
136 $this->ParameterList[] =& $string;
137
138 $ret = true;
139 }
140 }
141 }
142
143 return $ret;
144 }
145
149 function parameterList()
150 {
151 return $this->ParameterList;
152 }
153
157 function clearParameters( )
158 {
159 $this->ParameterList = array();
160 }
161
166 function &payload( )
167 {
168 $parameters = "";
169 if ( count( $this->ParameterList ) > 0 )
170 {
171 $parameters = "<params>\n";
172
173 foreach ( $this->ParameterList as $parameter )
174 {
175 $parameters .= "<param>\n" .
176 $parameter->serialize() .
177 "</param>\n";
178 }
179
180 $parameters .= "</params>";
181 }
182
183 $payload = "<?xml version=\"1.0\"?>\n" .
184 "<methodCall>\n" .
185 "<methodName>" . $this->MethodName . "</methodName>\n" .
186 $parameters .
187 "</methodCall>\n";
188
189 return $payload;
190 }
191
195 function decodeStream( $rawResponse )
196 {
197 // create a new decoder object
198 $decoder = new eZXMLRPCDataTypeDecoder( );
199
200 // $rawResponse = eZXMLRPCResponse::stripHTTPHeader( $rawResponse );
201
202 // eZPBLog::writeNotice( "empty?: " . $rawResponse . "<-" );
203 // $domTree =& qdom_tree( $rawResponse );
204 // $domTree =& xmltree( $rawResponse );
205
206 $domTree =& eZXML::domTree( $rawResponse, array( "TrimWhiteSpace" => true ) );
207
208 // print_r( $domTree );
209
210 foreach ( $domTree->children as $call )
211 {
212 if ( $call->name == "methodCall" )
213 {
214 foreach ( $call->children as $callItem )
215 {
216 // method name
217 if ( $callItem->name == "methodName" )
218 {
219 foreach ( $callItem->children as $value )
220 {
221 if ( $value->name == "#text" || $value->name == "text" )
222 {
223 $this->MethodName = $value->content;
224 }
225 }
226 }
227
228 // parameters
229 if ( $callItem->name == "params" && is_array( $callItem->children ) )
230 {
231 foreach ( $callItem->children as $param )
232 {
233 if ( $param->name == "param" )
234 {
235 foreach ( $param->children as $value )
236 {
237 if ( $value->name == "value" )
238 {
239 $this->ParameterList[] = $decoder->decodeDataTypes( $value );
240 }
241 }
242 }
243 }
244 }
245 }
246 }
247 }
248 }
249
250
252 var $MethodName;
253
255 var $ParameterList;
256
257 }
258
259 ?>
eZXMLRPCCall
Definition: ezxmlrpccall.php:40
eZXMLRPCCall\setMethodName
setMethodName( $name)
Definition: ezxmlrpccall.php:52
eZXMLRPCCall\clearParameters
clearParameters()
Definition: ezxmlrpccall.php:157
eZXMLRPCCall\__construct
__construct()
Definition: ezxmlrpccall.php:44
eZXMLRPCCall\addParameter
addParameter( $value)
Definition: ezxmlrpccall.php:75
eZXMLRPCCall\$MethodName
$MethodName
The name of the method to call.
Definition: ezxmlrpccall.php:252
eZXMLRPCCall\payload
& payload()
Definition: ezxmlrpccall.php:166
eZXMLRPCCall\parameterList
parameterList()
Definition: ezxmlrpccall.php:149
eZXMLRPCCall\decodeStream
decodeStream( $rawResponse)
Definition: ezxmlrpccall.php:195
eZXMLRPCCall\$ParameterList
$ParameterList
The parameters to send with the method.
Definition: ezxmlrpccall.php:255
eZXMLRPCCall\methodName
methodName()
Definition: ezxmlrpccall.php:60
eZXMLRPCDataTypeDecoder
Definition: ezxmlrpcdatatypedecoder.php:37
eZXMLRPCString
Definition: ezxmlrpcstring.php:37
eZXML\domTree
static domTree( $xmlDoc, $params=array())
Definition: ezxml.php:60
$name
$name
Definition: companytypelist.php:194
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.