Completed
Push — 1.11.x ( 6904fa...6a92e6 )
by José
525:44 queued 484:20
created
main/inc/lib/formvalidator/Rule/UsernameAvailable.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
  */
7 7
 class HTML_QuickForm_Rule_UsernameAvailable extends HTML_QuickForm_Rule
8 8
 {
9
-	/**
10
-	 * Function to check if a username is available
11
-	 * @see HTML_QuickForm_Rule
12
-	 * @param string $username Wanted username
13
-	 * @param string $current_username
14
-	 * @return boolean True if username is available
15
-	 */
16
-	function validate($username, $current_username = null) {
17
-		$user_table = Database::get_main_table(TABLE_MAIN_USER);
9
+    /**
10
+     * Function to check if a username is available
11
+     * @see HTML_QuickForm_Rule
12
+     * @param string $username Wanted username
13
+     * @param string $current_username
14
+     * @return boolean True if username is available
15
+     */
16
+    function validate($username, $current_username = null) {
17
+        $user_table = Database::get_main_table(TABLE_MAIN_USER);
18 18
         $username = Database::escape_string($username);
19 19
         $current_username = Database::escape_string($current_username);
20 20
 
21
-		$sql = "SELECT * FROM $user_table WHERE username = '$username'";
22
-		if (!is_null($current_username)) {
23
-			$sql .= " AND username != '$current_username'";
24
-		}
25
-		$res = Database::query($sql);
26
-		$number = Database::num_rows($res);
27
-		return $number == 0;
28
-	}
21
+        $sql = "SELECT * FROM $user_table WHERE username = '$username'";
22
+        if (!is_null($current_username)) {
23
+            $sql .= " AND username != '$current_username'";
24
+        }
25
+        $res = Database::query($sql);
26
+        $number = Database::num_rows($res);
27
+        return $number == 0;
28
+    }
29 29
 }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/CompareDateTimeText.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      * @return boolean True if the 2 given dates match the operator
13 13
      */
14 14
     function validate($values, $operator = null) {
15
-    	$datetime1 = api_strtotime($values[0]);
15
+        $datetime1 = api_strtotime($values[0]);
16 16
         $datetime2 = api_strtotime($values[1]);
17 17
 
18 18
         if (strpos($operator, 'allow_empty') !== false) {
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
                 return true;
22 22
             }
23 23
         }
24
-		$result =  parent::validate(array($datetime1, $datetime2), $operator);
24
+        $result =  parent::validate(array($datetime1, $datetime2), $operator);
25 25
         return $result;
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/MultipleRequired.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     function validate($value, $options = null)
29 29
     {
30
-    	if(is_array($value))
31
-    	{
32
-    		$value = implode(null,$value);
33
-    	}
30
+        if(is_array($value))
31
+        {
32
+            $value = implode(null,$value);
33
+        }
34 34
         if ((string)$value == '') {
35 35
             return false;
36 36
         }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/FileName.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@
 block discarded – undo
9 9
 class HTML_QuickForm_Rule_FileName extends HTML_QuickForm_Rule
10 10
 {
11 11
 
12
-	/**
13
-	 * @param $value array     Uploaded file info (from $_FILES)
14
-	 * @param null $options
15
-	 * @return bool
16
-	 */
17
-	public function validate($value, $options = null)
18
-	{
19
-		if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
20
-			(!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
21
-			return is_uploaded_file($elementValue['tmp_name']);
22
-		} else {
23
-			return false;
24
-		}
25
-	}
12
+    /**
13
+     * @param $value array     Uploaded file info (from $_FILES)
14
+     * @param null $options
15
+     * @return bool
16
+     */
17
+    public function validate($value, $options = null)
18
+    {
19
+        if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
20
+            (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
21
+            return is_uploaded_file($elementValue['tmp_name']);
22
+        } else {
23
+            return false;
24
+        }
25
+    }
26 26
 }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/MaxFileSize.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@
 block discarded – undo
7 7
  */
8 8
 class HTML_QuickForm_Rule_MaxFileSize extends HTML_QuickForm_Rule
9 9
 {
10
-	/**
11
-	 * @param $value array     Uploaded file info (from $_FILES)
12
-	 * @param null $options
13
-	 * @return bool
14
-	 */
15
-	public function validate($elementValue, $maxSize)
16
-	{
17
-		if (!empty($elementValue['error']) &&
18
-			(UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])
19
-		) {
20
-			return false;
21
-		}
22
-		if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
23
-			return true;
24
-		}
10
+    /**
11
+     * @param $value array     Uploaded file info (from $_FILES)
12
+     * @param null $options
13
+     * @return bool
14
+     */
15
+    public function validate($elementValue, $maxSize)
16
+    {
17
+        if (!empty($elementValue['error']) &&
18
+            (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])
19
+        ) {
20
+            return false;
21
+        }
22
+        if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
23
+            return true;
24
+        }
25 25
 
26
-		return ($maxSize >= @filesize($elementValue['tmp_name']));
27
-	}
26
+        return ($maxSize >= @filesize($elementValue['tmp_name']));
27
+    }
28 28
 }
Please login to merge, or discard this patch.
main/inc/lib/event_email_template.class.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
     /**
13 13
      * Constructor
14 14
      */
15
-	public function __construct()
15
+    public function __construct()
16 16
     {
17 17
         $this->table =  Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
18
-	}
18
+    }
19 19
 
20 20
     public function get_all($where_conditions = array())
21 21
     {
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * Displays the title + grid
31 31
      */
32
-	public function display()
32
+    public function display()
33 33
     {
34
-		// action links
35
-		$content = Display::actions(array(
34
+        // action links
35
+        $content = Display::actions(array(
36 36
                 array(
37 37
                     'url' => 'event_type.php' ,
38 38
                     'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM)
39
-                 )
39
+                    )
40 40
             )
41 41
         );
42 42
         $content .= Display::grid_html('event_email_template');
43 43
         return $content;
44
-	}
44
+    }
45 45
 
46 46
     public function get_status_list()
47 47
     {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 'Height' => '250',
83 83
             )
84 84
         );
85
-	    $status_list = $this->get_status_list();
85
+        $status_list = $this->get_status_list();
86 86
         $form->addElement('select', 'status', get_lang('Status'), $status_list);
87 87
         if ($action == 'edit') {
88 88
             $form->addElement('text', 'created_at', get_lang('CreatedAt'));
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
         $defaults = $this->get($id);
100 100
 
101 101
         if (!empty($defaults['created_at'])) {
102
-        	$defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
102
+            $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
103 103
         }
104 104
         if (!empty($defaults['updated_at'])) {
105
-        	$defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
105
+            $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
106 106
         }
107 107
         $form->setDefaults($defaults);
108 108
 
109 109
         // Setting the rules
110 110
         $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
111 111
 
112
-		return $form;
112
+        return $form;
113 113
     }
114 114
 
115 115
     public function get_count()
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.xmlschema.php 1 patch
Indentation   +880 added lines, -880 removed lines patch added patch discarded remove patch
@@ -14,275 +14,275 @@  discard block
 block discarded – undo
14 14
 */
15 15
 class nusoap_xmlschema extends nusoap_base  {
16 16
 	
17
-	// files
18
-	var $schema = '';
19
-	var $xml = '';
20
-	// namespaces
21
-	var $enclosingNamespaces;
22
-	// schema info
23
-	var $schemaInfo = array();
24
-	var $schemaTargetNamespace = '';
25
-	// types, elements, attributes defined by the schema
26
-	var $attributes = array();
27
-	var $complexTypes = array();
28
-	var $complexTypeStack = array();
29
-	var $currentComplexType = null;
30
-	var $elements = array();
31
-	var $elementStack = array();
32
-	var $currentElement = null;
33
-	var $simpleTypes = array();
34
-	var $simpleTypeStack = array();
35
-	var $currentSimpleType = null;
36
-	// imports
37
-	var $imports = array();
38
-	// parser vars
39
-	var $parser;
40
-	var $position = 0;
41
-	var $depth = 0;
42
-	var $depth_array = array();
43
-	var $message = array();
44
-	var $defaultNamespace = array();
17
+    // files
18
+    var $schema = '';
19
+    var $xml = '';
20
+    // namespaces
21
+    var $enclosingNamespaces;
22
+    // schema info
23
+    var $schemaInfo = array();
24
+    var $schemaTargetNamespace = '';
25
+    // types, elements, attributes defined by the schema
26
+    var $attributes = array();
27
+    var $complexTypes = array();
28
+    var $complexTypeStack = array();
29
+    var $currentComplexType = null;
30
+    var $elements = array();
31
+    var $elementStack = array();
32
+    var $currentElement = null;
33
+    var $simpleTypes = array();
34
+    var $simpleTypeStack = array();
35
+    var $currentSimpleType = null;
36
+    // imports
37
+    var $imports = array();
38
+    // parser vars
39
+    var $parser;
40
+    var $position = 0;
41
+    var $depth = 0;
42
+    var $depth_array = array();
43
+    var $message = array();
44
+    var $defaultNamespace = array();
45 45
     
46
-	/**
47
-	* constructor
48
-	*
49
-	* @param    string $schema schema document URI
50
-	* @param    string $xml xml document URI
51
-	* @param	string $namespaces namespaces defined in enclosing XML
52
-	* @access   public
53
-	*/
54
-	function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
55
-		parent::nusoap_base();
56
-		$this->debug('nusoap_xmlschema class instantiated, inside constructor');
57
-		// files
58
-		$this->schema = $schema;
59
-		$this->xml = $xml;
46
+    /**
47
+     * constructor
48
+     *
49
+     * @param    string $schema schema document URI
50
+     * @param    string $xml xml document URI
51
+     * @param	string $namespaces namespaces defined in enclosing XML
52
+     * @access   public
53
+     */
54
+    function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
55
+        parent::nusoap_base();
56
+        $this->debug('nusoap_xmlschema class instantiated, inside constructor');
57
+        // files
58
+        $this->schema = $schema;
59
+        $this->xml = $xml;
60 60
 
61
-		// namespaces
62
-		$this->enclosingNamespaces = $namespaces;
63
-		$this->namespaces = array_merge($this->namespaces, $namespaces);
61
+        // namespaces
62
+        $this->enclosingNamespaces = $namespaces;
63
+        $this->namespaces = array_merge($this->namespaces, $namespaces);
64 64
 
65
-		// parse schema file
66
-		if($schema != ''){
67
-			$this->debug('initial schema file: '.$schema);
68
-			$this->parseFile($schema, 'schema');
69
-		}
65
+        // parse schema file
66
+        if($schema != ''){
67
+            $this->debug('initial schema file: '.$schema);
68
+            $this->parseFile($schema, 'schema');
69
+        }
70 70
 
71
-		// parse xml file
72
-		if($xml != ''){
73
-			$this->debug('initial xml file: '.$xml);
74
-			$this->parseFile($xml, 'xml');
75
-		}
71
+        // parse xml file
72
+        if($xml != ''){
73
+            $this->debug('initial xml file: '.$xml);
74
+            $this->parseFile($xml, 'xml');
75
+        }
76 76
 
77
-	}
77
+    }
78 78
 
79 79
     /**
80
-    * parse an XML file
81
-    *
82
-    * @param string $xml path/URL to XML file
83
-    * @param string $type (schema | xml)
84
-	* @return boolean
85
-    * @access public
86
-    */
87
-	function parseFile($xml,$type){
88
-		// parse xml file
89
-		if($xml != ""){
90
-			$xmlStr = @join("",@file($xml));
91
-			if($xmlStr == ""){
92
-				$msg = 'Error reading XML from '.$xml;
93
-				$this->setError($msg);
94
-				$this->debug($msg);
95
-			return false;
96
-			} else {
97
-				$this->debug("parsing $xml");
98
-				$this->parseString($xmlStr,$type);
99
-				$this->debug("done parsing $xml");
100
-			return true;
101
-			}
102
-		}
103
-		return false;
104
-	}
80
+     * parse an XML file
81
+     *
82
+     * @param string $xml path/URL to XML file
83
+     * @param string $type (schema | xml)
84
+     * @return boolean
85
+     * @access public
86
+     */
87
+    function parseFile($xml,$type){
88
+        // parse xml file
89
+        if($xml != ""){
90
+            $xmlStr = @join("",@file($xml));
91
+            if($xmlStr == ""){
92
+                $msg = 'Error reading XML from '.$xml;
93
+                $this->setError($msg);
94
+                $this->debug($msg);
95
+            return false;
96
+            } else {
97
+                $this->debug("parsing $xml");
98
+                $this->parseString($xmlStr,$type);
99
+                $this->debug("done parsing $xml");
100
+            return true;
101
+            }
102
+        }
103
+        return false;
104
+    }
105 105
 
106
-	/**
107
-	* parse an XML string
108
-	*
109
-	* @param    string $xml path or URL
110
-    * @param	string $type (schema|xml)
111
-	* @access   private
112
-	*/
113
-	function parseString($xml,$type){
114
-		// parse xml string
115
-		if($xml != ""){
106
+    /**
107
+     * parse an XML string
108
+     *
109
+     * @param    string $xml path or URL
110
+     * @param	string $type (schema|xml)
111
+     * @access   private
112
+     */
113
+    function parseString($xml,$type){
114
+        // parse xml string
115
+        if($xml != ""){
116 116
 
117
-	    	// Create an XML parser.
118
-	    	$this->parser = xml_parser_create();
119
-	    	// Set the options for parsing the XML data.
120
-	    	xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
117
+            // Create an XML parser.
118
+            $this->parser = xml_parser_create();
119
+            // Set the options for parsing the XML data.
120
+            xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
121 121
 
122
-	    	// Set the object for the parser.
123
-	    	xml_set_object($this->parser, $this);
122
+            // Set the object for the parser.
123
+            xml_set_object($this->parser, $this);
124 124
 
125
-	    	// Set the element handlers for the parser.
126
-			if($type == "schema"){
127
-		    	xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
128
-		    	xml_set_character_data_handler($this->parser,'schemaCharacterData');
129
-			} elseif($type == "xml"){
130
-				xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
131
-		    	xml_set_character_data_handler($this->parser,'xmlCharacterData');
132
-			}
125
+            // Set the element handlers for the parser.
126
+            if($type == "schema"){
127
+                xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
128
+                xml_set_character_data_handler($this->parser,'schemaCharacterData');
129
+            } elseif($type == "xml"){
130
+                xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
131
+                xml_set_character_data_handler($this->parser,'xmlCharacterData');
132
+            }
133 133
 
134
-		    // Parse the XML file.
135
-		    if(!xml_parse($this->parser,$xml,true)){
136
-			// Display an error message.
137
-				$errstr = sprintf('XML error parsing XML schema on line %d: %s',
138
-				xml_get_current_line_number($this->parser),
139
-				xml_error_string(xml_get_error_code($this->parser))
140
-				);
141
-				$this->debug($errstr);
142
-				$this->debug("XML payload:\n" . $xml);
143
-				$this->setError($errstr);
144
-	    	}
134
+            // Parse the XML file.
135
+            if(!xml_parse($this->parser,$xml,true)){
136
+            // Display an error message.
137
+                $errstr = sprintf('XML error parsing XML schema on line %d: %s',
138
+                xml_get_current_line_number($this->parser),
139
+                xml_error_string(xml_get_error_code($this->parser))
140
+                );
141
+                $this->debug($errstr);
142
+                $this->debug("XML payload:\n" . $xml);
143
+                $this->setError($errstr);
144
+            }
145 145
             
146
-			xml_parser_free($this->parser);
147
-		} else{
148
-			$this->debug('no xml passed to parseString()!!');
149
-			$this->setError('no xml passed to parseString()!!');
150
-		}
151
-	}
146
+            xml_parser_free($this->parser);
147
+        } else{
148
+            $this->debug('no xml passed to parseString()!!');
149
+            $this->setError('no xml passed to parseString()!!');
150
+        }
151
+    }
152 152
 
153
-	/**
154
-	 * gets a type name for an unnamed type
155
-	 *
156
-	 * @param	string	Element name
157
-	 * @return	string	A type name for an unnamed type
158
-	 * @access	private
159
-	 */
160
-	function CreateTypeName($ename) {
161
-		$scope = '';
162
-		for ($i = 0; $i < count($this->complexTypeStack); $i++) {
163
-			$scope .= $this->complexTypeStack[$i] . '_';
164
-		}
165
-		return $scope . $ename . '_ContainedType';
166
-	}
153
+    /**
154
+     * gets a type name for an unnamed type
155
+     *
156
+     * @param	string	Element name
157
+     * @return	string	A type name for an unnamed type
158
+     * @access	private
159
+     */
160
+    function CreateTypeName($ename) {
161
+        $scope = '';
162
+        for ($i = 0; $i < count($this->complexTypeStack); $i++) {
163
+            $scope .= $this->complexTypeStack[$i] . '_';
164
+        }
165
+        return $scope . $ename . '_ContainedType';
166
+    }
167 167
 	
168
-	/**
169
-	* start-element handler
170
-	*
171
-	* @param    string $parser XML parser object
172
-	* @param    string $name element name
173
-	* @param    string $attrs associative array of attributes
174
-	* @access   private
175
-	*/
176
-	function schemaStartElement($parser, $name, $attrs) {
168
+    /**
169
+     * start-element handler
170
+     *
171
+     * @param    string $parser XML parser object
172
+     * @param    string $name element name
173
+     * @param    string $attrs associative array of attributes
174
+     * @access   private
175
+     */
176
+    function schemaStartElement($parser, $name, $attrs) {
177 177
 		
178
-		// position in the total number of elements, starting from 0
179
-		$pos = $this->position++;
180
-		$depth = $this->depth++;
181
-		// set self as current value for this depth
182
-		$this->depth_array[$depth] = $pos;
183
-		$this->message[$pos] = array('cdata' => ''); 
184
-		if ($depth > 0) {
185
-			$this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
186
-		} else {
187
-			$this->defaultNamespace[$pos] = false;
188
-		}
178
+        // position in the total number of elements, starting from 0
179
+        $pos = $this->position++;
180
+        $depth = $this->depth++;
181
+        // set self as current value for this depth
182
+        $this->depth_array[$depth] = $pos;
183
+        $this->message[$pos] = array('cdata' => ''); 
184
+        if ($depth > 0) {
185
+            $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
186
+        } else {
187
+            $this->defaultNamespace[$pos] = false;
188
+        }
189 189
 
190
-		// get element prefix
191
-		if($prefix = $this->getPrefix($name)){
192
-			// get unqualified name
193
-			$name = $this->getLocalPart($name);
194
-		} else {
195
-        	$prefix = '';
190
+        // get element prefix
191
+        if($prefix = $this->getPrefix($name)){
192
+            // get unqualified name
193
+            $name = $this->getLocalPart($name);
194
+        } else {
195
+            $prefix = '';
196 196
         }
197 197
 		
198 198
         // loop thru attributes, expanding, and registering namespace declarations
199 199
         if(count($attrs) > 0){
200
-        	foreach($attrs as $k => $v){
200
+            foreach($attrs as $k => $v){
201 201
                 // if ns declarations, add to class level array of valid namespaces
202
-				if(preg_match('/^xmlns/',$k)){
203
-                	//$this->xdebug("$k: $v");
204
-                	//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
205
-                	if($ns_prefix = substr(strrchr($k,':'),1)){
206
-                		//$this->xdebug("Add namespace[$ns_prefix] = $v");
207
-						$this->namespaces[$ns_prefix] = $v;
208
-					} else {
209
-						$this->defaultNamespace[$pos] = $v;
210
-						if (! $this->getPrefixFromNamespace($v)) {
211
-							$this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
212
-						}
213
-					}
214
-					if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){
215
-						$this->XMLSchemaVersion = $v;
216
-						$this->namespaces['xsi'] = $v.'-instance';
217
-					}
218
-				}
219
-        	}
220
-        	foreach($attrs as $k => $v){
202
+                if(preg_match('/^xmlns/',$k)){
203
+                    //$this->xdebug("$k: $v");
204
+                    //$this->xdebug('ns_prefix: '.$this->getPrefix($k));
205
+                    if($ns_prefix = substr(strrchr($k,':'),1)){
206
+                        //$this->xdebug("Add namespace[$ns_prefix] = $v");
207
+                        $this->namespaces[$ns_prefix] = $v;
208
+                    } else {
209
+                        $this->defaultNamespace[$pos] = $v;
210
+                        if (! $this->getPrefixFromNamespace($v)) {
211
+                            $this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
212
+                        }
213
+                    }
214
+                    if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){
215
+                        $this->XMLSchemaVersion = $v;
216
+                        $this->namespaces['xsi'] = $v.'-instance';
217
+                    }
218
+                }
219
+            }
220
+            foreach($attrs as $k => $v){
221 221
                 // expand each attribute
222 222
                 $k = strpos($k,':') ? $this->expandQname($k) : $k;
223 223
                 $v = strpos($v,':') ? $this->expandQname($v) : $v;
224
-        		$eAttrs[$k] = $v;
225
-        	}
226
-        	$attrs = $eAttrs;
224
+                $eAttrs[$k] = $v;
225
+            }
226
+            $attrs = $eAttrs;
227 227
         } else {
228
-        	$attrs = array();
228
+            $attrs = array();
229 229
         }
230
-		// find status, register data
231
-		switch($name){
232
-			case 'all':			// (optional) compositor content for a complexType
233
-			case 'choice':
234
-			case 'group':
235
-			case 'sequence':
236
-				//$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement");
237
-				$this->complexTypes[$this->currentComplexType]['compositor'] = $name;
238
-				//if($name == 'all' || $name == 'sequence'){
239
-				//	$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
240
-				//}
241
-			break;
242
-			case 'attribute':	// complexType attribute
243
-            	//$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']);
244
-            	$this->xdebug("parsing attribute:");
245
-            	$this->appendDebug($this->varDump($attrs));
246
-				if (!isset($attrs['form'])) {
247
-					// TODO: handle globals
248
-					$attrs['form'] = $this->schemaInfo['attributeFormDefault'];
249
-				}
250
-            	if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
251
-					$v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
252
-					if (!strpos($v, ':')) {
253
-						// no namespace in arrayType attribute value...
254
-						if ($this->defaultNamespace[$pos]) {
255
-							// ...so use the default
256
-							$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
257
-						}
258
-					}
259
-            	}
230
+        // find status, register data
231
+        switch($name){
232
+            case 'all':			// (optional) compositor content for a complexType
233
+            case 'choice':
234
+            case 'group':
235
+            case 'sequence':
236
+                //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement");
237
+                $this->complexTypes[$this->currentComplexType]['compositor'] = $name;
238
+                //if($name == 'all' || $name == 'sequence'){
239
+                //	$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
240
+                //}
241
+            break;
242
+            case 'attribute':	// complexType attribute
243
+                //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']);
244
+                $this->xdebug("parsing attribute:");
245
+                $this->appendDebug($this->varDump($attrs));
246
+                if (!isset($attrs['form'])) {
247
+                    // TODO: handle globals
248
+                    $attrs['form'] = $this->schemaInfo['attributeFormDefault'];
249
+                }
250
+                if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
251
+                    $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
252
+                    if (!strpos($v, ':')) {
253
+                        // no namespace in arrayType attribute value...
254
+                        if ($this->defaultNamespace[$pos]) {
255
+                            // ...so use the default
256
+                            $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
257
+                        }
258
+                    }
259
+                }
260 260
                 if(isset($attrs['name'])){
261
-					$this->attributes[$attrs['name']] = $attrs;
262
-					$aname = $attrs['name'];
263
-				} elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){
264
-					if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
265
-	                	$aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
266
-	                } else {
267
-	                	$aname = '';
268
-	                }
269
-				} elseif(isset($attrs['ref'])){
270
-					$aname = $attrs['ref'];
261
+                    $this->attributes[$attrs['name']] = $attrs;
262
+                    $aname = $attrs['name'];
263
+                } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){
264
+                    if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
265
+                        $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
266
+                    } else {
267
+                        $aname = '';
268
+                    }
269
+                } elseif(isset($attrs['ref'])){
270
+                    $aname = $attrs['ref'];
271 271
                     $this->attributes[$attrs['ref']] = $attrs;
272
-				}
272
+                }
273 273
                 
274
-				if($this->currentComplexType){	// This should *always* be
275
-					$this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
276
-				}
277
-				// arrayType attribute
278
-				if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){
279
-					$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
280
-                	$prefix = $this->getPrefix($aname);
281
-					if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){
282
-						$v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
283
-					} else {
284
-						$v = '';
285
-					}
274
+                if($this->currentComplexType){	// This should *always* be
275
+                    $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
276
+                }
277
+                // arrayType attribute
278
+                if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){
279
+                    $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
280
+                    $prefix = $this->getPrefix($aname);
281
+                    if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){
282
+                        $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
283
+                    } else {
284
+                        $v = '';
285
+                    }
286 286
                     if(strpos($v,'[,]')){
287 287
                         $this->complexTypes[$this->currentComplexType]['multidimensional'] = true;
288 288
                     }
@@ -291,676 +291,676 @@  discard block
 block discarded – undo
291 291
                         $v = $this->XMLSchemaVersion.':'.$v;
292 292
                     }
293 293
                     $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
294
-				}
295
-			break;
296
-			case 'complexContent':	// (optional) content for a complexType
297
-				$this->xdebug("do nothing for element $name");
298
-			break;
299
-			case 'complexType':
300
-				array_push($this->complexTypeStack, $this->currentComplexType);
301
-				if(isset($attrs['name'])){
302
-					// TODO: what is the scope of named complexTypes that appear
303
-					//       nested within other c complexTypes?
304
-					$this->xdebug('processing named complexType '.$attrs['name']);
305
-					//$this->currentElement = false;
306
-					$this->currentComplexType = $attrs['name'];
307
-					$this->complexTypes[$this->currentComplexType] = $attrs;
308
-					$this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
309
-					// This is for constructs like
310
-					//           <complexType name="ListOfString" base="soap:Array">
311
-					//                <sequence>
312
-					//                    <element name="string" type="xsd:string"
313
-					//                        minOccurs="0" maxOccurs="unbounded" />
314
-					//                </sequence>
315
-					//            </complexType>
316
-					if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
317
-						$this->xdebug('complexType is unusual array');
318
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
319
-					} else {
320
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
321
-					}
322
-				} else {
323
-					$name = $this->CreateTypeName($this->currentElement);
324
-					$this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name);
325
-					$this->currentComplexType = $name;
326
-					//$this->currentElement = false;
327
-					$this->complexTypes[$this->currentComplexType] = $attrs;
328
-					$this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
329
-					// This is for constructs like
330
-					//           <complexType name="ListOfString" base="soap:Array">
331
-					//                <sequence>
332
-					//                    <element name="string" type="xsd:string"
333
-					//                        minOccurs="0" maxOccurs="unbounded" />
334
-					//                </sequence>
335
-					//            </complexType>
336
-					if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
337
-						$this->xdebug('complexType is unusual array');
338
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
339
-					} else {
340
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
341
-					}
342
-				}
343
-				$this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false';
344
-			break;
345
-			case 'element':
346
-				array_push($this->elementStack, $this->currentElement);
347
-				if (!isset($attrs['form'])) {
348
-					if ($this->currentComplexType) {
349
-						$attrs['form'] = $this->schemaInfo['elementFormDefault'];
350
-					} else {
351
-						// global
352
-						$attrs['form'] = 'qualified';
353
-					}
354
-				}
355
-				if(isset($attrs['type'])){
356
-					$this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
357
-					if (! $this->getPrefix($attrs['type'])) {
358
-						if ($this->defaultNamespace[$pos]) {
359
-							$attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
360
-							$this->xdebug('used default namespace to make type ' . $attrs['type']);
361
-						}
362
-					}
363
-					// This is for constructs like
364
-					//           <complexType name="ListOfString" base="soap:Array">
365
-					//                <sequence>
366
-					//                    <element name="string" type="xsd:string"
367
-					//                        minOccurs="0" maxOccurs="unbounded" />
368
-					//                </sequence>
369
-					//            </complexType>
370
-					if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
371
-						$this->xdebug('arrayType for unusual array is ' . $attrs['type']);
372
-						$this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
373
-					}
374
-					$this->currentElement = $attrs['name'];
375
-					$ename = $attrs['name'];
376
-				} elseif(isset($attrs['ref'])){
377
-					$this->xdebug("processing element as ref to ".$attrs['ref']);
378
-					$this->currentElement = "ref to ".$attrs['ref'];
379
-					$ename = $this->getLocalPart($attrs['ref']);
380
-				} else {
381
-					$type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']);
382
-					$this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type);
383
-					$this->currentElement = $attrs['name'];
384
-					$attrs['type'] = $this->schemaTargetNamespace . ':' . $type;
385
-					$ename = $attrs['name'];
386
-				}
387
-				if (isset($ename) && $this->currentComplexType) {
388
-					$this->xdebug("add element $ename to complexType $this->currentComplexType");
389
-					$this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
390
-				} elseif (!isset($attrs['ref'])) {
391
-					$this->xdebug("add element $ename to elements array");
392
-					$this->elements[ $attrs['name'] ] = $attrs;
393
-					$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
394
-				}
395
-			break;
396
-			case 'enumeration':	//	restriction value list member
397
-				$this->xdebug('enumeration ' . $attrs['value']);
398
-				if ($this->currentSimpleType) {
399
-					$this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
400
-				} elseif ($this->currentComplexType) {
401
-					$this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
402
-				}
403
-			break;
404
-			case 'extension':	// simpleContent or complexContent type extension
405
-				$this->xdebug('extension ' . $attrs['base']);
406
-				if ($this->currentComplexType) {
407
-					$ns = $this->getPrefix($attrs['base']);
408
-					if ($ns == '') {
409
-						$this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base'];
410
-					} else {
411
-						$this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
412
-					}
413
-				} else {
414
-					$this->xdebug('no current complexType to set extensionBase');
415
-				}
416
-			break;
417
-			case 'import':
418
-			    if (isset($attrs['schemaLocation'])) {
419
-					$this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
294
+                }
295
+            break;
296
+            case 'complexContent':	// (optional) content for a complexType
297
+                $this->xdebug("do nothing for element $name");
298
+            break;
299
+            case 'complexType':
300
+                array_push($this->complexTypeStack, $this->currentComplexType);
301
+                if(isset($attrs['name'])){
302
+                    // TODO: what is the scope of named complexTypes that appear
303
+                    //       nested within other c complexTypes?
304
+                    $this->xdebug('processing named complexType '.$attrs['name']);
305
+                    //$this->currentElement = false;
306
+                    $this->currentComplexType = $attrs['name'];
307
+                    $this->complexTypes[$this->currentComplexType] = $attrs;
308
+                    $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
309
+                    // This is for constructs like
310
+                    //           <complexType name="ListOfString" base="soap:Array">
311
+                    //                <sequence>
312
+                    //                    <element name="string" type="xsd:string"
313
+                    //                        minOccurs="0" maxOccurs="unbounded" />
314
+                    //                </sequence>
315
+                    //            </complexType>
316
+                    if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
317
+                        $this->xdebug('complexType is unusual array');
318
+                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
319
+                    } else {
320
+                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
321
+                    }
322
+                } else {
323
+                    $name = $this->CreateTypeName($this->currentElement);
324
+                    $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name);
325
+                    $this->currentComplexType = $name;
326
+                    //$this->currentElement = false;
327
+                    $this->complexTypes[$this->currentComplexType] = $attrs;
328
+                    $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
329
+                    // This is for constructs like
330
+                    //           <complexType name="ListOfString" base="soap:Array">
331
+                    //                <sequence>
332
+                    //                    <element name="string" type="xsd:string"
333
+                    //                        minOccurs="0" maxOccurs="unbounded" />
334
+                    //                </sequence>
335
+                    //            </complexType>
336
+                    if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
337
+                        $this->xdebug('complexType is unusual array');
338
+                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
339
+                    } else {
340
+                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
341
+                    }
342
+                }
343
+                $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false';
344
+            break;
345
+            case 'element':
346
+                array_push($this->elementStack, $this->currentElement);
347
+                if (!isset($attrs['form'])) {
348
+                    if ($this->currentComplexType) {
349
+                        $attrs['form'] = $this->schemaInfo['elementFormDefault'];
350
+                    } else {
351
+                        // global
352
+                        $attrs['form'] = 'qualified';
353
+                    }
354
+                }
355
+                if(isset($attrs['type'])){
356
+                    $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
357
+                    if (! $this->getPrefix($attrs['type'])) {
358
+                        if ($this->defaultNamespace[$pos]) {
359
+                            $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
360
+                            $this->xdebug('used default namespace to make type ' . $attrs['type']);
361
+                        }
362
+                    }
363
+                    // This is for constructs like
364
+                    //           <complexType name="ListOfString" base="soap:Array">
365
+                    //                <sequence>
366
+                    //                    <element name="string" type="xsd:string"
367
+                    //                        minOccurs="0" maxOccurs="unbounded" />
368
+                    //                </sequence>
369
+                    //            </complexType>
370
+                    if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
371
+                        $this->xdebug('arrayType for unusual array is ' . $attrs['type']);
372
+                        $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
373
+                    }
374
+                    $this->currentElement = $attrs['name'];
375
+                    $ename = $attrs['name'];
376
+                } elseif(isset($attrs['ref'])){
377
+                    $this->xdebug("processing element as ref to ".$attrs['ref']);
378
+                    $this->currentElement = "ref to ".$attrs['ref'];
379
+                    $ename = $this->getLocalPart($attrs['ref']);
380
+                } else {
381
+                    $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']);
382
+                    $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type);
383
+                    $this->currentElement = $attrs['name'];
384
+                    $attrs['type'] = $this->schemaTargetNamespace . ':' . $type;
385
+                    $ename = $attrs['name'];
386
+                }
387
+                if (isset($ename) && $this->currentComplexType) {
388
+                    $this->xdebug("add element $ename to complexType $this->currentComplexType");
389
+                    $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
390
+                } elseif (!isset($attrs['ref'])) {
391
+                    $this->xdebug("add element $ename to elements array");
392
+                    $this->elements[ $attrs['name'] ] = $attrs;
393
+                    $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
394
+                }
395
+            break;
396
+            case 'enumeration':	//	restriction value list member
397
+                $this->xdebug('enumeration ' . $attrs['value']);
398
+                if ($this->currentSimpleType) {
399
+                    $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
400
+                } elseif ($this->currentComplexType) {
401
+                    $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
402
+                }
403
+            break;
404
+            case 'extension':	// simpleContent or complexContent type extension
405
+                $this->xdebug('extension ' . $attrs['base']);
406
+                if ($this->currentComplexType) {
407
+                    $ns = $this->getPrefix($attrs['base']);
408
+                    if ($ns == '') {
409
+                        $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base'];
410
+                    } else {
411
+                        $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
412
+                    }
413
+                } else {
414
+                    $this->xdebug('no current complexType to set extensionBase');
415
+                }
416
+            break;
417
+            case 'import':
418
+                if (isset($attrs['schemaLocation'])) {
419
+                    $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
420 420
                     $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
421
-				} else {
422
-					$this->xdebug('import namespace ' . $attrs['namespace']);
421
+                } else {
422
+                    $this->xdebug('import namespace ' . $attrs['namespace']);
423 423
                     $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
424
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
425
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
426
-					}
427
-				}
428
-			break;
429
-			case 'include':
430
-			    if (isset($attrs['schemaLocation'])) {
431
-					$this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']);
424
+                    if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
425
+                        $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
426
+                    }
427
+                }
428
+            break;
429
+            case 'include':
430
+                if (isset($attrs['schemaLocation'])) {
431
+                    $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']);
432 432
                     $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
433
-				} else {
434
-					$this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute');
435
-				}
436
-			break;
437
-			case 'list':	// simpleType value list
438
-				$this->xdebug("do nothing for element $name");
439
-			break;
440
-			case 'restriction':	// simpleType, simpleContent or complexContent value restriction
441
-				$this->xdebug('restriction ' . $attrs['base']);
442
-				if($this->currentSimpleType){
443
-					$this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
444
-				} elseif($this->currentComplexType){
445
-					$this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
446
-					if(strstr($attrs['base'],':') == ':Array'){
447
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
448
-					}
449
-				}
450
-			break;
451
-			case 'schema':
452
-				$this->schemaInfo = $attrs;
453
-				$this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
454
-				if (isset($attrs['targetNamespace'])) {
455
-					$this->schemaTargetNamespace = $attrs['targetNamespace'];
456
-				}
457
-				if (!isset($attrs['elementFormDefault'])) {
458
-					$this->schemaInfo['elementFormDefault'] = 'unqualified';
459
-				}
460
-				if (!isset($attrs['attributeFormDefault'])) {
461
-					$this->schemaInfo['attributeFormDefault'] = 'unqualified';
462
-				}
463
-			break;
464
-			case 'simpleContent':	// (optional) content for a complexType
465
-				if ($this->currentComplexType) {	// This should *always* be
466
-					$this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true';
467
-				} else {
468
-					$this->xdebug("do nothing for element $name because there is no current complexType");
469
-				}
470
-			break;
471
-			case 'simpleType':
472
-				array_push($this->simpleTypeStack, $this->currentSimpleType);
473
-				if(isset($attrs['name'])){
474
-					$this->xdebug("processing simpleType for name " . $attrs['name']);
475
-					$this->currentSimpleType = $attrs['name'];
476
-					$this->simpleTypes[ $attrs['name'] ] = $attrs;
477
-					$this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
478
-					$this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
479
-				} else {
480
-					$name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement);
481
-					$this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name);
482
-					$this->currentSimpleType = $name;
483
-					//$this->currentElement = false;
484
-					$this->simpleTypes[$this->currentSimpleType] = $attrs;
485
-					$this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
486
-				}
487
-			break;
488
-			case 'union':	// simpleType type list
489
-				$this->xdebug("do nothing for element $name");
490
-			break;
491
-			default:
492
-				$this->xdebug("do not have any logic to process element $name");
493
-		}
494
-	}
433
+                } else {
434
+                    $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute');
435
+                }
436
+            break;
437
+            case 'list':	// simpleType value list
438
+                $this->xdebug("do nothing for element $name");
439
+            break;
440
+            case 'restriction':	// simpleType, simpleContent or complexContent value restriction
441
+                $this->xdebug('restriction ' . $attrs['base']);
442
+                if($this->currentSimpleType){
443
+                    $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
444
+                } elseif($this->currentComplexType){
445
+                    $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
446
+                    if(strstr($attrs['base'],':') == ':Array'){
447
+                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
448
+                    }
449
+                }
450
+            break;
451
+            case 'schema':
452
+                $this->schemaInfo = $attrs;
453
+                $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
454
+                if (isset($attrs['targetNamespace'])) {
455
+                    $this->schemaTargetNamespace = $attrs['targetNamespace'];
456
+                }
457
+                if (!isset($attrs['elementFormDefault'])) {
458
+                    $this->schemaInfo['elementFormDefault'] = 'unqualified';
459
+                }
460
+                if (!isset($attrs['attributeFormDefault'])) {
461
+                    $this->schemaInfo['attributeFormDefault'] = 'unqualified';
462
+                }
463
+            break;
464
+            case 'simpleContent':	// (optional) content for a complexType
465
+                if ($this->currentComplexType) {	// This should *always* be
466
+                    $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true';
467
+                } else {
468
+                    $this->xdebug("do nothing for element $name because there is no current complexType");
469
+                }
470
+            break;
471
+            case 'simpleType':
472
+                array_push($this->simpleTypeStack, $this->currentSimpleType);
473
+                if(isset($attrs['name'])){
474
+                    $this->xdebug("processing simpleType for name " . $attrs['name']);
475
+                    $this->currentSimpleType = $attrs['name'];
476
+                    $this->simpleTypes[ $attrs['name'] ] = $attrs;
477
+                    $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
478
+                    $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
479
+                } else {
480
+                    $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement);
481
+                    $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name);
482
+                    $this->currentSimpleType = $name;
483
+                    //$this->currentElement = false;
484
+                    $this->simpleTypes[$this->currentSimpleType] = $attrs;
485
+                    $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
486
+                }
487
+            break;
488
+            case 'union':	// simpleType type list
489
+                $this->xdebug("do nothing for element $name");
490
+            break;
491
+            default:
492
+                $this->xdebug("do not have any logic to process element $name");
493
+        }
494
+    }
495 495
 
496
-	/**
497
-	* end-element handler
498
-	*
499
-	* @param    string $parser XML parser object
500
-	* @param    string $name element name
501
-	* @access   private
502
-	*/
503
-	function schemaEndElement($parser, $name) {
504
-		// bring depth down a notch
505
-		$this->depth--;
506
-		// position of current element is equal to the last value left in depth_array for my depth
507
-		if(isset($this->depth_array[$this->depth])){
508
-        	$pos = $this->depth_array[$this->depth];
496
+    /**
497
+     * end-element handler
498
+     *
499
+     * @param    string $parser XML parser object
500
+     * @param    string $name element name
501
+     * @access   private
502
+     */
503
+    function schemaEndElement($parser, $name) {
504
+        // bring depth down a notch
505
+        $this->depth--;
506
+        // position of current element is equal to the last value left in depth_array for my depth
507
+        if(isset($this->depth_array[$this->depth])){
508
+            $pos = $this->depth_array[$this->depth];
509
+        }
510
+        // get element prefix
511
+        if ($prefix = $this->getPrefix($name)){
512
+            // get unqualified name
513
+            $name = $this->getLocalPart($name);
514
+        } else {
515
+            $prefix = '';
516
+        }
517
+        // move on...
518
+        if($name == 'complexType'){
519
+            $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
520
+            $this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType]));
521
+            $this->currentComplexType = array_pop($this->complexTypeStack);
522
+            //$this->currentElement = false;
509 523
         }
510
-		// get element prefix
511
-		if ($prefix = $this->getPrefix($name)){
512
-			// get unqualified name
513
-			$name = $this->getLocalPart($name);
514
-		} else {
515
-        	$prefix = '';
524
+        if($name == 'element'){
525
+            $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)'));
526
+            $this->currentElement = array_pop($this->elementStack);
516 527
         }
517
-		// move on...
518
-		if($name == 'complexType'){
519
-			$this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
520
-			$this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType]));
521
-			$this->currentComplexType = array_pop($this->complexTypeStack);
522
-			//$this->currentElement = false;
523
-		}
524
-		if($name == 'element'){
525
-			$this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)'));
526
-			$this->currentElement = array_pop($this->elementStack);
527
-		}
528
-		if($name == 'simpleType'){
529
-			$this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
530
-			$this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType]));
531
-			$this->currentSimpleType = array_pop($this->simpleTypeStack);
532
-		}
533
-	}
528
+        if($name == 'simpleType'){
529
+            $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
530
+            $this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType]));
531
+            $this->currentSimpleType = array_pop($this->simpleTypeStack);
532
+        }
533
+    }
534 534
 
535
-	/**
536
-	* element content handler
537
-	*
538
-	* @param    string $parser XML parser object
539
-	* @param    string $data element content
540
-	* @access   private
541
-	*/
542
-	function schemaCharacterData($parser, $data){
543
-		$pos = $this->depth_array[$this->depth - 1];
544
-		$this->message[$pos]['cdata'] .= $data;
545
-	}
535
+    /**
536
+     * element content handler
537
+     *
538
+     * @param    string $parser XML parser object
539
+     * @param    string $data element content
540
+     * @access   private
541
+     */
542
+    function schemaCharacterData($parser, $data){
543
+        $pos = $this->depth_array[$this->depth - 1];
544
+        $this->message[$pos]['cdata'] .= $data;
545
+    }
546 546
 
547
-	/**
548
-	* serialize the schema
549
-	*
550
-	* @access   public
551
-	*/
552
-	function serializeSchema(){
547
+    /**
548
+     * serialize the schema
549
+     *
550
+     * @access   public
551
+     */
552
+    function serializeSchema(){
553 553
 
554
-		$schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
555
-		$xml = '';
556
-		// imports
557
-		if (sizeof($this->imports) > 0) {
558
-			foreach($this->imports as $ns => $list) {
559
-				foreach ($list as $ii) {
560
-					if ($ii['location'] != '') {
561
-						$xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n";
562
-					} else {
563
-						$xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
564
-					}
565
-				}
566
-			} 
567
-		} 
568
-		// complex types
569
-		foreach($this->complexTypes as $typeName => $attrs){
570
-			$contentStr = '';
571
-			// serialize child elements
572
-			if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){
573
-				foreach($attrs['elements'] as $element => $eParts){
574
-					if(isset($eParts['ref'])){
575
-						$contentStr .= "   <$schemaPrefix:element ref=\"$element\"/>\n";
576
-					} else {
577
-						$contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"";
578
-						foreach ($eParts as $aName => $aValue) {
579
-							// handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable
580
-							if ($aName != 'name' && $aName != 'type') {
581
-								$contentStr .= " $aName=\"$aValue\"";
582
-							}
583
-						}
584
-						$contentStr .= "/>\n";
585
-					}
586
-				}
587
-				// compositor wraps elements
588
-				if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) {
589
-					$contentStr = "  <$schemaPrefix:$attrs[compositor]>\n".$contentStr."  </$schemaPrefix:$attrs[compositor]>\n";
590
-				}
591
-			}
592
-			// attributes
593
-			if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){
594
-				foreach($attrs['attrs'] as $attr => $aParts){
595
-					$contentStr .= "    <$schemaPrefix:attribute";
596
-					foreach ($aParts as $a => $v) {
597
-						if ($a == 'ref' || $a == 'type') {
598
-							$contentStr .= " $a=\"".$this->contractQName($v).'"';
599
-						} elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') {
600
-							$this->usedNamespaces['wsdl'] = $this->namespaces['wsdl'];
601
-							$contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"';
602
-						} else {
603
-							$contentStr .= " $a=\"$v\"";
604
-						}
605
-					}
606
-					$contentStr .= "/>\n";
607
-				}
608
-			}
609
-			// if restriction
610
-			if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){
611
-				$contentStr = "   <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr."   </$schemaPrefix:restriction>\n";
612
-				// complex or simple content
613
-				if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){
614
-					$contentStr = "  <$schemaPrefix:complexContent>\n".$contentStr."  </$schemaPrefix:complexContent>\n";
615
-				}
616
-			}
617
-			// finalize complex type
618
-			if($contentStr != ''){
619
-				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n";
620
-			} else {
621
-				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n";
622
-			}
623
-			$xml .= $contentStr;
624
-		}
625
-		// simple types
626
-		if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
627
-			foreach($this->simpleTypes as $typeName => $eParts){
628
-				$xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n  <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n";
629
-				if (isset($eParts['enumeration'])) {
630
-					foreach ($eParts['enumeration'] as $e) {
631
-						$xml .= "  <$schemaPrefix:enumeration value=\"$e\"/>\n";
632
-					}
633
-				}
634
-				$xml .= "  </$schemaPrefix:restriction>\n </$schemaPrefix:simpleType>";
635
-			}
636
-		}
637
-		// elements
638
-		if(isset($this->elements) && count($this->elements) > 0){
639
-			foreach($this->elements as $element => $eParts){
640
-				$xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n";
641
-			}
642
-		}
643
-		// attributes
644
-		if(isset($this->attributes) && count($this->attributes) > 0){
645
-			foreach($this->attributes as $attr => $aParts){
646
-				$xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>";
647
-			}
648
-		}
649
-		// finish 'er up
650
-		$attr = '';
651
-		foreach ($this->schemaInfo as $k => $v) {
652
-			if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') {
653
-				$attr .= " $k=\"$v\"";
654
-			}
655
-		}
656
-		$el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n";
657
-		foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
658
-			$el .= " xmlns:$nsp=\"$ns\"";
659
-		}
660
-		$xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n";
661
-		return $xml;
662
-	}
554
+        $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
555
+        $xml = '';
556
+        // imports
557
+        if (sizeof($this->imports) > 0) {
558
+            foreach($this->imports as $ns => $list) {
559
+                foreach ($list as $ii) {
560
+                    if ($ii['location'] != '') {
561
+                        $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n";
562
+                    } else {
563
+                        $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
564
+                    }
565
+                }
566
+            } 
567
+        } 
568
+        // complex types
569
+        foreach($this->complexTypes as $typeName => $attrs){
570
+            $contentStr = '';
571
+            // serialize child elements
572
+            if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){
573
+                foreach($attrs['elements'] as $element => $eParts){
574
+                    if(isset($eParts['ref'])){
575
+                        $contentStr .= "   <$schemaPrefix:element ref=\"$element\"/>\n";
576
+                    } else {
577
+                        $contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"";
578
+                        foreach ($eParts as $aName => $aValue) {
579
+                            // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable
580
+                            if ($aName != 'name' && $aName != 'type') {
581
+                                $contentStr .= " $aName=\"$aValue\"";
582
+                            }
583
+                        }
584
+                        $contentStr .= "/>\n";
585
+                    }
586
+                }
587
+                // compositor wraps elements
588
+                if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) {
589
+                    $contentStr = "  <$schemaPrefix:$attrs[compositor]>\n".$contentStr."  </$schemaPrefix:$attrs[compositor]>\n";
590
+                }
591
+            }
592
+            // attributes
593
+            if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){
594
+                foreach($attrs['attrs'] as $attr => $aParts){
595
+                    $contentStr .= "    <$schemaPrefix:attribute";
596
+                    foreach ($aParts as $a => $v) {
597
+                        if ($a == 'ref' || $a == 'type') {
598
+                            $contentStr .= " $a=\"".$this->contractQName($v).'"';
599
+                        } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') {
600
+                            $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl'];
601
+                            $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"';
602
+                        } else {
603
+                            $contentStr .= " $a=\"$v\"";
604
+                        }
605
+                    }
606
+                    $contentStr .= "/>\n";
607
+                }
608
+            }
609
+            // if restriction
610
+            if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){
611
+                $contentStr = "   <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr."   </$schemaPrefix:restriction>\n";
612
+                // complex or simple content
613
+                if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){
614
+                    $contentStr = "  <$schemaPrefix:complexContent>\n".$contentStr."  </$schemaPrefix:complexContent>\n";
615
+                }
616
+            }
617
+            // finalize complex type
618
+            if($contentStr != ''){
619
+                $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n";
620
+            } else {
621
+                $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n";
622
+            }
623
+            $xml .= $contentStr;
624
+        }
625
+        // simple types
626
+        if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
627
+            foreach($this->simpleTypes as $typeName => $eParts){
628
+                $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n  <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n";
629
+                if (isset($eParts['enumeration'])) {
630
+                    foreach ($eParts['enumeration'] as $e) {
631
+                        $xml .= "  <$schemaPrefix:enumeration value=\"$e\"/>\n";
632
+                    }
633
+                }
634
+                $xml .= "  </$schemaPrefix:restriction>\n </$schemaPrefix:simpleType>";
635
+            }
636
+        }
637
+        // elements
638
+        if(isset($this->elements) && count($this->elements) > 0){
639
+            foreach($this->elements as $element => $eParts){
640
+                $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n";
641
+            }
642
+        }
643
+        // attributes
644
+        if(isset($this->attributes) && count($this->attributes) > 0){
645
+            foreach($this->attributes as $attr => $aParts){
646
+                $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>";
647
+            }
648
+        }
649
+        // finish 'er up
650
+        $attr = '';
651
+        foreach ($this->schemaInfo as $k => $v) {
652
+            if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') {
653
+                $attr .= " $k=\"$v\"";
654
+            }
655
+        }
656
+        $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n";
657
+        foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
658
+            $el .= " xmlns:$nsp=\"$ns\"";
659
+        }
660
+        $xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n";
661
+        return $xml;
662
+    }
663 663
 
664
-	/**
665
-	* adds debug data to the clas level debug string
666
-	*
667
-	* @param    string $string debug data
668
-	* @access   private
669
-	*/
670
-	function xdebug($string){
671
-		$this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
672
-	}
664
+    /**
665
+     * adds debug data to the clas level debug string
666
+     *
667
+     * @param    string $string debug data
668
+     * @access   private
669
+     */
670
+    function xdebug($string){
671
+        $this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
672
+    }
673 673
 
674 674
     /**
675
-    * get the PHP type of a user defined type in the schema
676
-    * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays
677
-    * returns false if no type exists, or not w/ the given namespace
678
-    * else returns a string that is either a native php type, or 'struct'
679
-    *
680
-    * @param string $type name of defined type
681
-    * @param string $ns namespace of type
682
-    * @return mixed
683
-    * @access public
684
-    * @deprecated
685
-    */
686
-	function getPHPType($type,$ns){
687
-		if(isset($this->typemap[$ns][$type])){
688
-			//print "found type '$type' and ns $ns in typemap<br>";
689
-			return $this->typemap[$ns][$type];
690
-		} elseif(isset($this->complexTypes[$type])){
691
-			//print "getting type '$type' and ns $ns from complexTypes array<br>";
692
-			return $this->complexTypes[$type]['phpType'];
693
-		}
694
-		return false;
695
-	}
675
+     * get the PHP type of a user defined type in the schema
676
+     * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays
677
+     * returns false if no type exists, or not w/ the given namespace
678
+     * else returns a string that is either a native php type, or 'struct'
679
+     *
680
+     * @param string $type name of defined type
681
+     * @param string $ns namespace of type
682
+     * @return mixed
683
+     * @access public
684
+     * @deprecated
685
+     */
686
+    function getPHPType($type,$ns){
687
+        if(isset($this->typemap[$ns][$type])){
688
+            //print "found type '$type' and ns $ns in typemap<br>";
689
+            return $this->typemap[$ns][$type];
690
+        } elseif(isset($this->complexTypes[$type])){
691
+            //print "getting type '$type' and ns $ns from complexTypes array<br>";
692
+            return $this->complexTypes[$type]['phpType'];
693
+        }
694
+        return false;
695
+    }
696 696
 
697
-	/**
698
-    * returns an associative array of information about a given type
699
-    * returns false if no type exists by the given name
700
-    *
701
-	*	For a complexType typeDef = array(
702
-	*	'restrictionBase' => '',
703
-	*	'phpType' => '',
704
-	*	'compositor' => '(sequence|all)',
705
-	*	'elements' => array(), // refs to elements array
706
-	*	'attrs' => array() // refs to attributes array
707
-	*	... and so on (see addComplexType)
708
-	*	)
709
-	*
710
-	*   For simpleType or element, the array has different keys.
711
-    *
712
-    * @param string $type
713
-    * @return mixed
714
-    * @access public
715
-    * @see addComplexType
716
-    * @see addSimpleType
717
-    * @see addElement
718
-    */
719
-	function getTypeDef($type){
720
-		//$this->debug("in getTypeDef for type $type");
721
-		if (substr($type, -1) == '^') {
722
-			$is_element = 1;
723
-			$type = substr($type, 0, -1);
724
-		} else {
725
-			$is_element = 0;
726
-		}
697
+    /**
698
+     * returns an associative array of information about a given type
699
+     * returns false if no type exists by the given name
700
+     *
701
+     *	For a complexType typeDef = array(
702
+     *	'restrictionBase' => '',
703
+     *	'phpType' => '',
704
+     *	'compositor' => '(sequence|all)',
705
+     *	'elements' => array(), // refs to elements array
706
+     *	'attrs' => array() // refs to attributes array
707
+     *	... and so on (see addComplexType)
708
+     *	)
709
+     *
710
+     *   For simpleType or element, the array has different keys.
711
+     *
712
+     * @param string $type
713
+     * @return mixed
714
+     * @access public
715
+     * @see addComplexType
716
+     * @see addSimpleType
717
+     * @see addElement
718
+     */
719
+    function getTypeDef($type){
720
+        //$this->debug("in getTypeDef for type $type");
721
+        if (substr($type, -1) == '^') {
722
+            $is_element = 1;
723
+            $type = substr($type, 0, -1);
724
+        } else {
725
+            $is_element = 0;
726
+        }
727 727
 
728
-		if((! $is_element) && isset($this->complexTypes[$type])){
729
-			$this->xdebug("in getTypeDef, found complexType $type");
730
-			return $this->complexTypes[$type];
731
-		} elseif((! $is_element) && isset($this->simpleTypes[$type])){
732
-			$this->xdebug("in getTypeDef, found simpleType $type");
733
-			if (!isset($this->simpleTypes[$type]['phpType'])) {
734
-				// get info for type to tack onto the simple type
735
-				// TODO: can this ever really apply (i.e. what is a simpleType really?)
736
-				$uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1);
737
-				$ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':'));
738
-				$etype = $this->getTypeDef($uqType);
739
-				if ($etype) {
740
-					$this->xdebug("in getTypeDef, found type for simpleType $type:");
741
-					$this->xdebug($this->varDump($etype));
742
-					if (isset($etype['phpType'])) {
743
-						$this->simpleTypes[$type]['phpType'] = $etype['phpType'];
744
-					}
745
-					if (isset($etype['elements'])) {
746
-						$this->simpleTypes[$type]['elements'] = $etype['elements'];
747
-					}
748
-				}
749
-			}
750
-			return $this->simpleTypes[$type];
751
-		} elseif(isset($this->elements[$type])){
752
-			$this->xdebug("in getTypeDef, found element $type");
753
-			if (!isset($this->elements[$type]['phpType'])) {
754
-				// get info for type to tack onto the element
755
-				$uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1);
756
-				$ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':'));
757
-				$etype = $this->getTypeDef($uqType);
758
-				if ($etype) {
759
-					$this->xdebug("in getTypeDef, found type for element $type:");
760
-					$this->xdebug($this->varDump($etype));
761
-					if (isset($etype['phpType'])) {
762
-						$this->elements[$type]['phpType'] = $etype['phpType'];
763
-					}
764
-					if (isset($etype['elements'])) {
765
-						$this->elements[$type]['elements'] = $etype['elements'];
766
-					}
767
-					if (isset($etype['extensionBase'])) {
768
-						$this->elements[$type]['extensionBase'] = $etype['extensionBase'];
769
-					}
770
-				} elseif ($ns == 'http://www.w3.org/2001/XMLSchema') {
771
-					$this->xdebug("in getTypeDef, element $type is an XSD type");
772
-					$this->elements[$type]['phpType'] = 'scalar';
773
-				}
774
-			}
775
-			return $this->elements[$type];
776
-		} elseif(isset($this->attributes[$type])){
777
-			$this->xdebug("in getTypeDef, found attribute $type");
778
-			return $this->attributes[$type];
779
-		} elseif (preg_match('/_ContainedType$/', $type)) {
780
-			$this->xdebug("in getTypeDef, have an untyped element $type");
781
-			$typeDef['typeClass'] = 'simpleType';
782
-			$typeDef['phpType'] = 'scalar';
783
-			$typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string';
784
-			return $typeDef;
785
-		}
786
-		$this->xdebug("in getTypeDef, did not find $type");
787
-		return false;
788
-	}
728
+        if((! $is_element) && isset($this->complexTypes[$type])){
729
+            $this->xdebug("in getTypeDef, found complexType $type");
730
+            return $this->complexTypes[$type];
731
+        } elseif((! $is_element) && isset($this->simpleTypes[$type])){
732
+            $this->xdebug("in getTypeDef, found simpleType $type");
733
+            if (!isset($this->simpleTypes[$type]['phpType'])) {
734
+                // get info for type to tack onto the simple type
735
+                // TODO: can this ever really apply (i.e. what is a simpleType really?)
736
+                $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1);
737
+                $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':'));
738
+                $etype = $this->getTypeDef($uqType);
739
+                if ($etype) {
740
+                    $this->xdebug("in getTypeDef, found type for simpleType $type:");
741
+                    $this->xdebug($this->varDump($etype));
742
+                    if (isset($etype['phpType'])) {
743
+                        $this->simpleTypes[$type]['phpType'] = $etype['phpType'];
744
+                    }
745
+                    if (isset($etype['elements'])) {
746
+                        $this->simpleTypes[$type]['elements'] = $etype['elements'];
747
+                    }
748
+                }
749
+            }
750
+            return $this->simpleTypes[$type];
751
+        } elseif(isset($this->elements[$type])){
752
+            $this->xdebug("in getTypeDef, found element $type");
753
+            if (!isset($this->elements[$type]['phpType'])) {
754
+                // get info for type to tack onto the element
755
+                $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1);
756
+                $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':'));
757
+                $etype = $this->getTypeDef($uqType);
758
+                if ($etype) {
759
+                    $this->xdebug("in getTypeDef, found type for element $type:");
760
+                    $this->xdebug($this->varDump($etype));
761
+                    if (isset($etype['phpType'])) {
762
+                        $this->elements[$type]['phpType'] = $etype['phpType'];
763
+                    }
764
+                    if (isset($etype['elements'])) {
765
+                        $this->elements[$type]['elements'] = $etype['elements'];
766
+                    }
767
+                    if (isset($etype['extensionBase'])) {
768
+                        $this->elements[$type]['extensionBase'] = $etype['extensionBase'];
769
+                    }
770
+                } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') {
771
+                    $this->xdebug("in getTypeDef, element $type is an XSD type");
772
+                    $this->elements[$type]['phpType'] = 'scalar';
773
+                }
774
+            }
775
+            return $this->elements[$type];
776
+        } elseif(isset($this->attributes[$type])){
777
+            $this->xdebug("in getTypeDef, found attribute $type");
778
+            return $this->attributes[$type];
779
+        } elseif (preg_match('/_ContainedType$/', $type)) {
780
+            $this->xdebug("in getTypeDef, have an untyped element $type");
781
+            $typeDef['typeClass'] = 'simpleType';
782
+            $typeDef['phpType'] = 'scalar';
783
+            $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string';
784
+            return $typeDef;
785
+        }
786
+        $this->xdebug("in getTypeDef, did not find $type");
787
+        return false;
788
+    }
789 789
 
790
-	/**
791
-    * returns a sample serialization of a given type, or false if no type by the given name
792
-    *
793
-    * @param string $type name of type
794
-    * @return mixed
795
-    * @access public
796
-    * @deprecated
797
-    */
790
+    /**
791
+     * returns a sample serialization of a given type, or false if no type by the given name
792
+     *
793
+     * @param string $type name of type
794
+     * @return mixed
795
+     * @access public
796
+     * @deprecated
797
+     */
798 798
     function serializeTypeDef($type){
799
-    	//print "in sTD() for type $type<br>";
800
-	if($typeDef = $this->getTypeDef($type)){
801
-		$str .= '<'.$type;
802
-	    if(is_array($typeDef['attrs'])){
803
-		foreach($typeDef['attrs'] as $attName => $data){
804
-		    $str .= " $attName=\"{type = ".$data['type']."}\"";
805
-		}
806
-	    }
807
-	    $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
808
-	    if(count($typeDef['elements']) > 0){
809
-		$str .= ">";
810
-		foreach($typeDef['elements'] as $element => $eData){
811
-		    $str .= $this->serializeTypeDef($element);
812
-		}
813
-		$str .= "</$type>";
814
-	    } elseif($typeDef['typeClass'] == 'element') {
815
-		$str .= "></$type>";
816
-	    } else {
817
-		$str .= "/>";
818
-	    }
819
-			return $str;
820
-	}
821
-    	return false;
799
+        //print "in sTD() for type $type<br>";
800
+    if($typeDef = $this->getTypeDef($type)){
801
+        $str .= '<'.$type;
802
+        if(is_array($typeDef['attrs'])){
803
+        foreach($typeDef['attrs'] as $attName => $data){
804
+            $str .= " $attName=\"{type = ".$data['type']."}\"";
805
+        }
806
+        }
807
+        $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
808
+        if(count($typeDef['elements']) > 0){
809
+        $str .= ">";
810
+        foreach($typeDef['elements'] as $element => $eData){
811
+            $str .= $this->serializeTypeDef($element);
812
+        }
813
+        $str .= "</$type>";
814
+        } elseif($typeDef['typeClass'] == 'element') {
815
+        $str .= "></$type>";
816
+        } else {
817
+        $str .= "/>";
818
+        }
819
+            return $str;
820
+    }
821
+        return false;
822 822
     }
823 823
 
824 824
     /**
825
-    * returns HTML form elements that allow a user
826
-    * to enter values for creating an instance of the given type.
827
-    *
828
-    * @param string $name name for type instance
829
-    * @param string $type name of type
830
-    * @return string
831
-    * @access public
832
-    * @deprecated
833
-	*/
834
-	function typeToForm($name,$type){
835
-		// get typedef
836
-		if($typeDef = $this->getTypeDef($type)){
837
-			// if struct
838
-			if($typeDef['phpType'] == 'struct'){
839
-				$buffer .= '<table>';
840
-				foreach($typeDef['elements'] as $child => $childDef){
841
-					$buffer .= "
825
+     * returns HTML form elements that allow a user
826
+     * to enter values for creating an instance of the given type.
827
+     *
828
+     * @param string $name name for type instance
829
+     * @param string $type name of type
830
+     * @return string
831
+     * @access public
832
+     * @deprecated
833
+     */
834
+    function typeToForm($name,$type){
835
+        // get typedef
836
+        if($typeDef = $this->getTypeDef($type)){
837
+            // if struct
838
+            if($typeDef['phpType'] == 'struct'){
839
+                $buffer .= '<table>';
840
+                foreach($typeDef['elements'] as $child => $childDef){
841
+                    $buffer .= "
842 842
 					<tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td>
843 843
 					<td><input type='text' name='parameters[".$name."][$childDef[name]]'></td></tr>";
844
-				}
845
-				$buffer .= '</table>';
846
-			// if array
847
-			} elseif($typeDef['phpType'] == 'array'){
848
-				$buffer .= '<table>';
849
-				for($i=0;$i < 3; $i++){
850
-					$buffer .= "
844
+                }
845
+                $buffer .= '</table>';
846
+            // if array
847
+            } elseif($typeDef['phpType'] == 'array'){
848
+                $buffer .= '<table>';
849
+                for($i=0;$i < 3; $i++){
850
+                    $buffer .= "
851 851
 					<tr><td align='right'>array item (type: $typeDef[arrayType]):</td>
852 852
 					<td><input type='text' name='parameters[".$name."][]'></td></tr>";
853
-				}
854
-				$buffer .= '</table>';
855
-			// if scalar
856
-			} else {
857
-				$buffer .= "<input type='text' name='parameters[$name]'>";
858
-			}
859
-		} else {
860
-			$buffer .= "<input type='text' name='parameters[$name]'>";
861
-		}
862
-		return $buffer;
863
-	}
853
+                }
854
+                $buffer .= '</table>';
855
+            // if scalar
856
+            } else {
857
+                $buffer .= "<input type='text' name='parameters[$name]'>";
858
+            }
859
+        } else {
860
+            $buffer .= "<input type='text' name='parameters[$name]'>";
861
+        }
862
+        return $buffer;
863
+    }
864 864
 	
865
-	/**
866
-	* adds a complex type to the schema
867
-	* 
868
-	* example: array
869
-	* 
870
-	* addType(
871
-	* 	'ArrayOfstring',
872
-	* 	'complexType',
873
-	* 	'array',
874
-	* 	'',
875
-	* 	'SOAP-ENC:Array',
876
-	* 	array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'),
877
-	* 	'xsd:string'
878
-	* );
879
-	* 
880
-	* example: PHP associative array ( SOAP Struct )
881
-	* 
882
-	* addType(
883
-	* 	'SOAPStruct',
884
-	* 	'complexType',
885
-	* 	'struct',
886
-	* 	'all',
887
-	* 	array('myVar'=> array('name'=>'myVar','type'=>'string')
888
-	* );
889
-	* 
890
-	* @param name
891
-	* @param typeClass (complexType|simpleType|attribute)
892
-	* @param phpType: currently supported are array and struct (php assoc array)
893
-	* @param compositor (all|sequence|choice)
894
-	* @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
895
-	* @param elements = array ( name = array(name=>'',type=>'') )
896
-	* @param attrs = array(
897
-	* 	array(
898
-	*		'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType",
899
-	*		"http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]"
900
-	* 	)
901
-	* )
902
-	* @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
903
-	* @access public
904
-	* @see getTypeDef
905
-	*/
906
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){
907
-		$this->complexTypes[$name] = array(
908
-	    'name'		=> $name,
909
-	    'typeClass'	=> $typeClass,
910
-	    'phpType'	=> $phpType,
911
-		'compositor'=> $compositor,
912
-	    'restrictionBase' => $restrictionBase,
913
-		'elements'	=> $elements,
914
-	    'attrs'		=> $attrs,
915
-	    'arrayType'	=> $arrayType
916
-		);
865
+    /**
866
+     * adds a complex type to the schema
867
+     * 
868
+     * example: array
869
+     * 
870
+     * addType(
871
+     * 	'ArrayOfstring',
872
+     * 	'complexType',
873
+     * 	'array',
874
+     * 	'',
875
+     * 	'SOAP-ENC:Array',
876
+     * 	array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'),
877
+     * 	'xsd:string'
878
+     * );
879
+     * 
880
+     * example: PHP associative array ( SOAP Struct )
881
+     * 
882
+     * addType(
883
+     * 	'SOAPStruct',
884
+     * 	'complexType',
885
+     * 	'struct',
886
+     * 	'all',
887
+     * 	array('myVar'=> array('name'=>'myVar','type'=>'string')
888
+     * );
889
+     * 
890
+     * @param name
891
+     * @param typeClass (complexType|simpleType|attribute)
892
+     * @param phpType: currently supported are array and struct (php assoc array)
893
+     * @param compositor (all|sequence|choice)
894
+     * @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
895
+     * @param elements = array ( name = array(name=>'',type=>'') )
896
+     * @param attrs = array(
897
+     * 	array(
898
+     *		'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType",
899
+     *		"http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]"
900
+     * 	)
901
+     * )
902
+     * @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
903
+     * @access public
904
+     * @see getTypeDef
905
+     */
906
+    function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){
907
+        $this->complexTypes[$name] = array(
908
+        'name'		=> $name,
909
+        'typeClass'	=> $typeClass,
910
+        'phpType'	=> $phpType,
911
+        'compositor'=> $compositor,
912
+        'restrictionBase' => $restrictionBase,
913
+        'elements'	=> $elements,
914
+        'attrs'		=> $attrs,
915
+        'arrayType'	=> $arrayType
916
+        );
917 917
 		
918
-		$this->xdebug("addComplexType $name:");
919
-		$this->appendDebug($this->varDump($this->complexTypes[$name]));
920
-	}
918
+        $this->xdebug("addComplexType $name:");
919
+        $this->appendDebug($this->varDump($this->complexTypes[$name]));
920
+    }
921 921
 	
922
-	/**
923
-	* adds a simple type to the schema
924
-	*
925
-	* @param string $name
926
-	* @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
927
-	* @param string $typeClass (should always be simpleType)
928
-	* @param string $phpType (should always be scalar)
929
-	* @param array $enumeration array of values
930
-	* @access public
931
-	* @see nusoap_xmlschema
932
-	* @see getTypeDef
933
-	*/
934
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
935
-		$this->simpleTypes[$name] = array(
936
-	    'name'			=> $name,
937
-	    'typeClass'		=> $typeClass,
938
-	    'phpType'		=> $phpType,
939
-	    'type'			=> $restrictionBase,
940
-	    'enumeration'	=> $enumeration
941
-		);
922
+    /**
923
+     * adds a simple type to the schema
924
+     *
925
+     * @param string $name
926
+     * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
927
+     * @param string $typeClass (should always be simpleType)
928
+     * @param string $phpType (should always be scalar)
929
+     * @param array $enumeration array of values
930
+     * @access public
931
+     * @see nusoap_xmlschema
932
+     * @see getTypeDef
933
+     */
934
+    function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
935
+        $this->simpleTypes[$name] = array(
936
+        'name'			=> $name,
937
+        'typeClass'		=> $typeClass,
938
+        'phpType'		=> $phpType,
939
+        'type'			=> $restrictionBase,
940
+        'enumeration'	=> $enumeration
941
+        );
942 942
 		
943
-		$this->xdebug("addSimpleType $name:");
944
-		$this->appendDebug($this->varDump($this->simpleTypes[$name]));
945
-	}
943
+        $this->xdebug("addSimpleType $name:");
944
+        $this->appendDebug($this->varDump($this->simpleTypes[$name]));
945
+    }
946 946
 
947
-	/**
948
-	* adds an element to the schema
949
-	*
950
-	* @param array $attrs attributes that must include name and type
951
-	* @see nusoap_xmlschema
952
-	* @access public
953
-	*/
954
-	function addElement($attrs) {
955
-		if (! $this->getPrefix($attrs['type'])) {
956
-			$attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
957
-		}
958
-		$this->elements[ $attrs['name'] ] = $attrs;
959
-		$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
947
+    /**
948
+     * adds an element to the schema
949
+     *
950
+     * @param array $attrs attributes that must include name and type
951
+     * @see nusoap_xmlschema
952
+     * @access public
953
+     */
954
+    function addElement($attrs) {
955
+        if (! $this->getPrefix($attrs['type'])) {
956
+            $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
957
+        }
958
+        $this->elements[ $attrs['name'] ] = $attrs;
959
+        $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
960 960
 		
961
-		$this->xdebug("addElement " . $attrs['name']);
962
-		$this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
963
-	}
961
+        $this->xdebug("addElement " . $attrs['name']);
962
+        $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
963
+    }
964 964
 }
965 965
 
966 966
 /**
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soapclient.php 1 patch
Indentation   +900 added lines, -900 removed lines patch added patch discarded remove patch
@@ -25,967 +25,967 @@
 block discarded – undo
25 25
 */
26 26
 class nusoap_client extends nusoap_base  {
27 27
 
28
-	var $username = '';				// Username for HTTP authentication
29
-	var $password = '';				// Password for HTTP authentication
30
-	var $authtype = '';				// Type of HTTP authentication
31
-	var $certRequest = array();		// Certificate for HTTP SSL authentication
32
-	var $requestHeaders = false;	// SOAP headers in request (text)
33
-	var $responseHeaders = '';		// SOAP headers from response (incomplete namespace resolution) (text)
34
-	var $responseHeader = NULL;		// SOAP Header from response (parsed)
35
-	var $document = '';				// SOAP body response portion (incomplete namespace resolution) (text)
36
-	var $endpoint;
37
-	var $forceEndpoint = '';		// overrides WSDL endpoint
28
+    var $username = '';				// Username for HTTP authentication
29
+    var $password = '';				// Password for HTTP authentication
30
+    var $authtype = '';				// Type of HTTP authentication
31
+    var $certRequest = array();		// Certificate for HTTP SSL authentication
32
+    var $requestHeaders = false;	// SOAP headers in request (text)
33
+    var $responseHeaders = '';		// SOAP headers from response (incomplete namespace resolution) (text)
34
+    var $responseHeader = NULL;		// SOAP Header from response (parsed)
35
+    var $document = '';				// SOAP body response portion (incomplete namespace resolution) (text)
36
+    var $endpoint;
37
+    var $forceEndpoint = '';		// overrides WSDL endpoint
38 38
     var $proxyhost = '';
39 39
     var $proxyport = '';
40
-	var $proxyusername = '';
41
-	var $proxypassword = '';
42
-	var $portName = '';				// port name to use in WSDL
40
+    var $proxyusername = '';
41
+    var $proxypassword = '';
42
+    var $portName = '';				// port name to use in WSDL
43 43
     var $xml_encoding = '';			// character set encoding of incoming (response) messages
44
-	var $http_encoding = false;
45
-	var $timeout = 0;				// HTTP connection timeout
46
-	var $response_timeout = 30;		// HTTP response timeout
47
-	var $endpointType = '';			// soap|wsdl, empty for WSDL initialization error
48
-	var $persistentConnection = false;
49
-	var $defaultRpcParams = false;	// This is no longer used
50
-	var $request = '';				// HTTP request
51
-	var $response = '';				// HTTP response
52
-	var $responseData = '';			// SOAP payload of response
53
-	var $cookies = array();			// Cookies from response or for request
44
+    var $http_encoding = false;
45
+    var $timeout = 0;				// HTTP connection timeout
46
+    var $response_timeout = 30;		// HTTP response timeout
47
+    var $endpointType = '';			// soap|wsdl, empty for WSDL initialization error
48
+    var $persistentConnection = false;
49
+    var $defaultRpcParams = false;	// This is no longer used
50
+    var $request = '';				// HTTP request
51
+    var $response = '';				// HTTP response
52
+    var $responseData = '';			// SOAP payload of response
53
+    var $cookies = array();			// Cookies from response or for request
54 54
     var $decode_utf8 = true;		// toggles whether the parser decodes element content w/ utf8_decode()
55
-	var $operations = array();		// WSDL operations, empty for WSDL initialization error
56
-	var $curl_options = array();	// User-specified cURL options
57
-	var $bindingType = '';			// WSDL operation binding type
58
-	var $use_curl = false;			// whether to always try to use cURL
55
+    var $operations = array();		// WSDL operations, empty for WSDL initialization error
56
+    var $curl_options = array();	// User-specified cURL options
57
+    var $bindingType = '';			// WSDL operation binding type
58
+    var $use_curl = false;			// whether to always try to use cURL
59 59
 
60
-	/*
60
+    /*
61 61
 	 * fault related variables
62 62
 	 */
63
-	/**
64
-	 * @var      fault
65
-	 * @access   public
66
-	 */
67
-	var $fault;
68
-	/**
69
-	 * @var      faultcode
70
-	 * @access   public
71
-	 */
72
-	var $faultcode;
73
-	/**
74
-	 * @var      faultstring
75
-	 * @access   public
76
-	 */
77
-	var $faultstring;
78
-	/**
79
-	 * @var      faultdetail
80
-	 * @access   public
81
-	 */
82
-	var $faultdetail;
83
-
84
-	/**
85
-	* constructor
86
-	*
87
-	* @param    mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
88
-	* @param    mixed $wsdl optional, set to 'wsdl' or true if using WSDL
89
-	* @param    string $proxyhost optional
90
-	* @param    string $proxyport optional
91
-	* @param	string $proxyusername optional
92
-	* @param	string $proxypassword optional
93
-	* @param	integer $timeout set the connection timeout
94
-	* @param	integer $response_timeout set the response timeout
95
-	* @param	string $portName optional portName in WSDL document
96
-	* @access   public
97
-	*/
98
-	function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
99
-		parent::nusoap_base();
100
-		$this->endpoint = $endpoint;
101
-		$this->proxyhost = $proxyhost;
102
-		$this->proxyport = $proxyport;
103
-		$this->proxyusername = $proxyusername;
104
-		$this->proxypassword = $proxypassword;
105
-		$this->timeout = $timeout;
106
-		$this->response_timeout = $response_timeout;
107
-		$this->portName = $portName;
108
-
109
-		$this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
110
-		$this->appendDebug('endpoint=' . $this->varDump($endpoint));
111
-
112
-		// make values
113
-		if($wsdl){
114
-			if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) {
115
-				$this->wsdl = $endpoint;
116
-				$this->endpoint = $this->wsdl->wsdl;
117
-				$this->wsdlFile = $this->endpoint;
118
-				$this->debug('existing wsdl instance created from ' . $this->endpoint);
119
-				$this->checkWSDL();
120
-			} else {
121
-				$this->wsdlFile = $this->endpoint;
122
-				$this->wsdl = null;
123
-				$this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint);
124
-			}
125
-			$this->endpointType = 'wsdl';
126
-		} else {
127
-			$this->debug("instantiate SOAP with endpoint at $endpoint");
128
-			$this->endpointType = 'soap';
129
-		}
130
-	}
63
+    /**
64
+     * @var      fault
65
+     * @access   public
66
+     */
67
+    var $fault;
68
+    /**
69
+     * @var      faultcode
70
+     * @access   public
71
+     */
72
+    var $faultcode;
73
+    /**
74
+     * @var      faultstring
75
+     * @access   public
76
+     */
77
+    var $faultstring;
78
+    /**
79
+     * @var      faultdetail
80
+     * @access   public
81
+     */
82
+    var $faultdetail;
131 83
 
132
-	/**
133
-	* calls method, returns PHP native type
134
-	*
135
-	* @param    string $operation SOAP server URL or path
136
-	* @param    mixed $params An array, associative or simple, of the parameters
137
-	*			              for the method call, or a string that is the XML
138
-	*			              for the call.  For rpc style, this call will
139
-	*			              wrap the XML in a tag named after the method, as
140
-	*			              well as the SOAP Envelope and Body.  For document
141
-	*			              style, this will only wrap with the Envelope and Body.
142
-	*			              IMPORTANT: when using an array with document style,
143
-	*			              in which case there
144
-	*                         is really one parameter, the root of the fragment
145
-	*                         used in the call, which encloses what programmers
146
-	*                         normally think of parameters.  A parameter array
147
-	*                         *must* include the wrapper.
148
-	* @param	string $namespace optional method namespace (WSDL can override)
149
-	* @param	string $soapAction optional SOAPAction value (WSDL can override)
150
-	* @param	mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array
151
-	* @param	boolean $rpcParams optional (no longer used)
152
-	* @param	string	$style optional (rpc|document) the style to use when serializing parameters (WSDL can override)
153
-	* @param	string	$use optional (encoded|literal) the use when serializing parameters (WSDL can override)
154
-	* @return	mixed	response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors
155
-	* @access   public
156
-	*/
157
-	function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){
158
-		$this->operation = $operation;
159
-		$this->fault = false;
160
-		$this->setError('');
161
-		$this->request = '';
162
-		$this->response = '';
163
-		$this->responseData = '';
164
-		$this->faultstring = '';
165
-		$this->faultcode = '';
166
-		$this->opData = array();
84
+    /**
85
+     * constructor
86
+     *
87
+     * @param    mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
88
+     * @param    mixed $wsdl optional, set to 'wsdl' or true if using WSDL
89
+     * @param    string $proxyhost optional
90
+     * @param    string $proxyport optional
91
+     * @param	string $proxyusername optional
92
+     * @param	string $proxypassword optional
93
+     * @param	integer $timeout set the connection timeout
94
+     * @param	integer $response_timeout set the response timeout
95
+     * @param	string $portName optional portName in WSDL document
96
+     * @access   public
97
+     */
98
+    function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
99
+        parent::nusoap_base();
100
+        $this->endpoint = $endpoint;
101
+        $this->proxyhost = $proxyhost;
102
+        $this->proxyport = $proxyport;
103
+        $this->proxyusername = $proxyusername;
104
+        $this->proxypassword = $proxypassword;
105
+        $this->timeout = $timeout;
106
+        $this->response_timeout = $response_timeout;
107
+        $this->portName = $portName;
108
+
109
+        $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
110
+        $this->appendDebug('endpoint=' . $this->varDump($endpoint));
111
+
112
+        // make values
113
+        if($wsdl){
114
+            if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) {
115
+                $this->wsdl = $endpoint;
116
+                $this->endpoint = $this->wsdl->wsdl;
117
+                $this->wsdlFile = $this->endpoint;
118
+                $this->debug('existing wsdl instance created from ' . $this->endpoint);
119
+                $this->checkWSDL();
120
+            } else {
121
+                $this->wsdlFile = $this->endpoint;
122
+                $this->wsdl = null;
123
+                $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint);
124
+            }
125
+            $this->endpointType = 'wsdl';
126
+        } else {
127
+            $this->debug("instantiate SOAP with endpoint at $endpoint");
128
+            $this->endpointType = 'soap';
129
+        }
130
+    }
131
+
132
+    /**
133
+     * calls method, returns PHP native type
134
+     *
135
+     * @param    string $operation SOAP server URL or path
136
+     * @param    mixed $params An array, associative or simple, of the parameters
137
+     *			              for the method call, or a string that is the XML
138
+     *			              for the call.  For rpc style, this call will
139
+     *			              wrap the XML in a tag named after the method, as
140
+     *			              well as the SOAP Envelope and Body.  For document
141
+     *			              style, this will only wrap with the Envelope and Body.
142
+     *			              IMPORTANT: when using an array with document style,
143
+     *			              in which case there
144
+     *                         is really one parameter, the root of the fragment
145
+     *                         used in the call, which encloses what programmers
146
+     *                         normally think of parameters.  A parameter array
147
+     *                         *must* include the wrapper.
148
+     * @param	string $namespace optional method namespace (WSDL can override)
149
+     * @param	string $soapAction optional SOAPAction value (WSDL can override)
150
+     * @param	mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array
151
+     * @param	boolean $rpcParams optional (no longer used)
152
+     * @param	string	$style optional (rpc|document) the style to use when serializing parameters (WSDL can override)
153
+     * @param	string	$use optional (encoded|literal) the use when serializing parameters (WSDL can override)
154
+     * @return	mixed	response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors
155
+     * @access   public
156
+     */
157
+    function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){
158
+        $this->operation = $operation;
159
+        $this->fault = false;
160
+        $this->setError('');
161
+        $this->request = '';
162
+        $this->response = '';
163
+        $this->responseData = '';
164
+        $this->faultstring = '';
165
+        $this->faultcode = '';
166
+        $this->opData = array();
167 167
 		
168
-		$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
169
-		$this->appendDebug('params=' . $this->varDump($params));
170
-		$this->appendDebug('headers=' . $this->varDump($headers));
171
-		if ($headers) {
172
-			$this->requestHeaders = $headers;
173
-		}
174
-		if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
175
-			$this->loadWSDL();
176
-			if ($this->getError())
177
-				return false;
178
-		}
179
-		// serialize parameters
180
-		if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
181
-			// use WSDL for operation
182
-			$this->opData = $opData;
183
-			$this->debug("found operation");
184
-			$this->appendDebug('opData=' . $this->varDump($opData));
185
-			if (isset($opData['soapAction'])) {
186
-				$soapAction = $opData['soapAction'];
187
-			}
188
-			if (! $this->forceEndpoint) {
189
-				$this->endpoint = $opData['endpoint'];
190
-			} else {
191
-				$this->endpoint = $this->forceEndpoint;
192
-			}
193
-			$namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] :	$namespace;
194
-			$style = $opData['style'];
195
-			$use = $opData['input']['use'];
196
-			// add ns to ns array
197
-			if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
198
-				$nsPrefix = 'ns' . rand(1000, 9999);
199
-				$this->wsdl->namespaces[$nsPrefix] = $namespace;
200
-			}
168
+        $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
169
+        $this->appendDebug('params=' . $this->varDump($params));
170
+        $this->appendDebug('headers=' . $this->varDump($headers));
171
+        if ($headers) {
172
+            $this->requestHeaders = $headers;
173
+        }
174
+        if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
175
+            $this->loadWSDL();
176
+            if ($this->getError())
177
+                return false;
178
+        }
179
+        // serialize parameters
180
+        if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
181
+            // use WSDL for operation
182
+            $this->opData = $opData;
183
+            $this->debug("found operation");
184
+            $this->appendDebug('opData=' . $this->varDump($opData));
185
+            if (isset($opData['soapAction'])) {
186
+                $soapAction = $opData['soapAction'];
187
+            }
188
+            if (! $this->forceEndpoint) {
189
+                $this->endpoint = $opData['endpoint'];
190
+            } else {
191
+                $this->endpoint = $this->forceEndpoint;
192
+            }
193
+            $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] :	$namespace;
194
+            $style = $opData['style'];
195
+            $use = $opData['input']['use'];
196
+            // add ns to ns array
197
+            if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
198
+                $nsPrefix = 'ns' . rand(1000, 9999);
199
+                $this->wsdl->namespaces[$nsPrefix] = $namespace;
200
+            }
201 201
             $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
202
-			// serialize payload
203
-			if (is_string($params)) {
204
-				$this->debug("serializing param string for WSDL operation $operation");
205
-				$payload = $params;
206
-			} elseif (is_array($params)) {
207
-				$this->debug("serializing param array for WSDL operation $operation");
208
-				$payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType);
209
-			} else {
210
-				$this->debug('params must be array or string');
211
-				$this->setError('params must be array or string');
212
-				return false;
213
-			}
202
+            // serialize payload
203
+            if (is_string($params)) {
204
+                $this->debug("serializing param string for WSDL operation $operation");
205
+                $payload = $params;
206
+            } elseif (is_array($params)) {
207
+                $this->debug("serializing param array for WSDL operation $operation");
208
+                $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType);
209
+            } else {
210
+                $this->debug('params must be array or string');
211
+                $this->setError('params must be array or string');
212
+                return false;
213
+            }
214 214
             $usedNamespaces = $this->wsdl->usedNamespaces;
215
-			if (isset($opData['input']['encodingStyle'])) {
216
-				$encodingStyle = $opData['input']['encodingStyle'];
217
-			} else {
218
-				$encodingStyle = '';
219
-			}
220
-			$this->appendDebug($this->wsdl->getDebug());
221
-			$this->wsdl->clearDebug();
222
-			if ($errstr = $this->wsdl->getError()) {
223
-				$this->debug('got wsdl error: '.$errstr);
224
-				$this->setError('wsdl error: '.$errstr);
225
-				return false;
226
-			}
227
-		} elseif($this->endpointType == 'wsdl') {
228
-			// operation not in WSDL
229
-			$this->appendDebug($this->wsdl->getDebug());
230
-			$this->wsdl->clearDebug();
231
-			$this->setError('operation '.$operation.' not present in WSDL.');
232
-			$this->debug("operation '$operation' not present in WSDL.");
233
-			return false;
234
-		} else {
235
-			// no WSDL
236
-			//$this->namespaces['ns1'] = $namespace;
237
-			$nsPrefix = 'ns' . rand(1000, 9999);
238
-			// serialize 
239
-			$payload = '';
240
-			if (is_string($params)) {
241
-				$this->debug("serializing param string for operation $operation");
242
-				$payload = $params;
243
-			} elseif (is_array($params)) {
244
-				$this->debug("serializing param array for operation $operation");
245
-				foreach($params as $k => $v){
246
-					$payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
247
-				}
248
-			} else {
249
-				$this->debug('params must be array or string');
250
-				$this->setError('params must be array or string');
251
-				return false;
252
-			}
253
-			$usedNamespaces = array();
254
-			if ($use == 'encoded') {
255
-				$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
256
-			} else {
257
-				$encodingStyle = '';
258
-			}
259
-		}
260
-		// wrap RPC calls with method element
261
-		if ($style == 'rpc') {
262
-			if ($use == 'literal') {
263
-				$this->debug("wrapping RPC request with literal method element");
264
-				if ($namespace) {
265
-					// http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
266
-					$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
267
-								$payload .
268
-								"</$nsPrefix:$operation>";
269
-				} else {
270
-					$payload = "<$operation>" . $payload . "</$operation>";
271
-				}
272
-			} else {
273
-				$this->debug("wrapping RPC request with encoded method element");
274
-				if ($namespace) {
275
-					$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
276
-								$payload .
277
-								"</$nsPrefix:$operation>";
278
-				} else {
279
-					$payload = "<$operation>" .
280
-								$payload .
281
-								"</$operation>";
282
-				}
283
-			}
284
-		}
285
-		// serialize envelope
286
-		$soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle);
287
-		$this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle");
288
-		$this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));
289
-		// send
290
-		$return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
291
-		if($errstr = $this->getError()){
292
-			$this->debug('Error: '.$errstr);
293
-			return false;
294
-		} else {
295
-			$this->return = $return;
296
-			$this->debug('sent message successfully and got a(n) '.gettype($return));
297
-           	$this->appendDebug('return=' . $this->varDump($return));
215
+            if (isset($opData['input']['encodingStyle'])) {
216
+                $encodingStyle = $opData['input']['encodingStyle'];
217
+            } else {
218
+                $encodingStyle = '';
219
+            }
220
+            $this->appendDebug($this->wsdl->getDebug());
221
+            $this->wsdl->clearDebug();
222
+            if ($errstr = $this->wsdl->getError()) {
223
+                $this->debug('got wsdl error: '.$errstr);
224
+                $this->setError('wsdl error: '.$errstr);
225
+                return false;
226
+            }
227
+        } elseif($this->endpointType == 'wsdl') {
228
+            // operation not in WSDL
229
+            $this->appendDebug($this->wsdl->getDebug());
230
+            $this->wsdl->clearDebug();
231
+            $this->setError('operation '.$operation.' not present in WSDL.');
232
+            $this->debug("operation '$operation' not present in WSDL.");
233
+            return false;
234
+        } else {
235
+            // no WSDL
236
+            //$this->namespaces['ns1'] = $namespace;
237
+            $nsPrefix = 'ns' . rand(1000, 9999);
238
+            // serialize 
239
+            $payload = '';
240
+            if (is_string($params)) {
241
+                $this->debug("serializing param string for operation $operation");
242
+                $payload = $params;
243
+            } elseif (is_array($params)) {
244
+                $this->debug("serializing param array for operation $operation");
245
+                foreach($params as $k => $v){
246
+                    $payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
247
+                }
248
+            } else {
249
+                $this->debug('params must be array or string');
250
+                $this->setError('params must be array or string');
251
+                return false;
252
+            }
253
+            $usedNamespaces = array();
254
+            if ($use == 'encoded') {
255
+                $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
256
+            } else {
257
+                $encodingStyle = '';
258
+            }
259
+        }
260
+        // wrap RPC calls with method element
261
+        if ($style == 'rpc') {
262
+            if ($use == 'literal') {
263
+                $this->debug("wrapping RPC request with literal method element");
264
+                if ($namespace) {
265
+                    // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
266
+                    $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
267
+                                $payload .
268
+                                "</$nsPrefix:$operation>";
269
+                } else {
270
+                    $payload = "<$operation>" . $payload . "</$operation>";
271
+                }
272
+            } else {
273
+                $this->debug("wrapping RPC request with encoded method element");
274
+                if ($namespace) {
275
+                    $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
276
+                                $payload .
277
+                                "</$nsPrefix:$operation>";
278
+                } else {
279
+                    $payload = "<$operation>" .
280
+                                $payload .
281
+                                "</$operation>";
282
+                }
283
+            }
284
+        }
285
+        // serialize envelope
286
+        $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle);
287
+        $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle");
288
+        $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));
289
+        // send
290
+        $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
291
+        if($errstr = $this->getError()){
292
+            $this->debug('Error: '.$errstr);
293
+            return false;
294
+        } else {
295
+            $this->return = $return;
296
+            $this->debug('sent message successfully and got a(n) '.gettype($return));
297
+                $this->appendDebug('return=' . $this->varDump($return));
298 298
 			
299
-			// fault?
300
-			if(is_array($return) && isset($return['faultcode'])){
301
-				$this->debug('got fault');
302
-				$this->setError($return['faultcode'].': '.$return['faultstring']);
303
-				$this->fault = true;
304
-				foreach($return as $k => $v){
305
-					$this->$k = $v;
306
-					$this->debug("$k = $v<br>");
307
-				}
308
-				return $return;
309
-			} elseif ($style == 'document') {
310
-				// NOTE: if the response is defined to have multiple parts (i.e. unwrapped),
311
-				// we are only going to return the first part here...sorry about that
312
-				return $return;
313
-			} else {
314
-				// array of return values
315
-				if(is_array($return)){
316
-					// multiple 'out' parameters, which we return wrapped up
317
-					// in the array
318
-					if(sizeof($return) > 1){
319
-						return $return;
320
-					}
321
-					// single 'out' parameter (normally the return value)
322
-					$return = array_shift($return);
323
-					$this->debug('return shifted value: ');
324
-					$this->appendDebug($this->varDump($return));
325
-           			return $return;
326
-				// nothing returned (ie, echoVoid)
327
-				} else {
328
-					return "";
329
-				}
330
-			}
331
-		}
332
-	}
299
+            // fault?
300
+            if(is_array($return) && isset($return['faultcode'])){
301
+                $this->debug('got fault');
302
+                $this->setError($return['faultcode'].': '.$return['faultstring']);
303
+                $this->fault = true;
304
+                foreach($return as $k => $v){
305
+                    $this->$k = $v;
306
+                    $this->debug("$k = $v<br>");
307
+                }
308
+                return $return;
309
+            } elseif ($style == 'document') {
310
+                // NOTE: if the response is defined to have multiple parts (i.e. unwrapped),
311
+                // we are only going to return the first part here...sorry about that
312
+                return $return;
313
+            } else {
314
+                // array of return values
315
+                if(is_array($return)){
316
+                    // multiple 'out' parameters, which we return wrapped up
317
+                    // in the array
318
+                    if(sizeof($return) > 1){
319
+                        return $return;
320
+                    }
321
+                    // single 'out' parameter (normally the return value)
322
+                    $return = array_shift($return);
323
+                    $this->debug('return shifted value: ');
324
+                    $this->appendDebug($this->varDump($return));
325
+                        return $return;
326
+                // nothing returned (ie, echoVoid)
327
+                } else {
328
+                    return "";
329
+                }
330
+            }
331
+        }
332
+    }
333 333
 
334
-	/**
335
-	* check WSDL passed as an instance or pulled from an endpoint
336
-	*
337
-	* @access   private
338
-	*/
339
-	function checkWSDL() {
340
-		$this->appendDebug($this->wsdl->getDebug());
341
-		$this->wsdl->clearDebug();
342
-		$this->debug('checkWSDL');
343
-		// catch errors
344
-		if ($errstr = $this->wsdl->getError()) {
345
-			$this->appendDebug($this->wsdl->getDebug());
346
-			$this->wsdl->clearDebug();
347
-			$this->debug('got wsdl error: '.$errstr);
348
-			$this->setError('wsdl error: '.$errstr);
349
-		} elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) {
350
-			$this->appendDebug($this->wsdl->getDebug());
351
-			$this->wsdl->clearDebug();
352
-			$this->bindingType = 'soap';
353
-			$this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType);
354
-		} elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) {
355
-			$this->appendDebug($this->wsdl->getDebug());
356
-			$this->wsdl->clearDebug();
357
-			$this->bindingType = 'soap12';
358
-			$this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType);
359
-			$this->debug('**************** WARNING: SOAP 1.2 BINDING *****************');
360
-		} else {
361
-			$this->appendDebug($this->wsdl->getDebug());
362
-			$this->wsdl->clearDebug();
363
-			$this->debug('getOperations returned false');
364
-			$this->setError('no operations defined in the WSDL document!');
365
-		}
366
-	}
334
+    /**
335
+     * check WSDL passed as an instance or pulled from an endpoint
336
+     *
337
+     * @access   private
338
+     */
339
+    function checkWSDL() {
340
+        $this->appendDebug($this->wsdl->getDebug());
341
+        $this->wsdl->clearDebug();
342
+        $this->debug('checkWSDL');
343
+        // catch errors
344
+        if ($errstr = $this->wsdl->getError()) {
345
+            $this->appendDebug($this->wsdl->getDebug());
346
+            $this->wsdl->clearDebug();
347
+            $this->debug('got wsdl error: '.$errstr);
348
+            $this->setError('wsdl error: '.$errstr);
349
+        } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) {
350
+            $this->appendDebug($this->wsdl->getDebug());
351
+            $this->wsdl->clearDebug();
352
+            $this->bindingType = 'soap';
353
+            $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType);
354
+        } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) {
355
+            $this->appendDebug($this->wsdl->getDebug());
356
+            $this->wsdl->clearDebug();
357
+            $this->bindingType = 'soap12';
358
+            $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType);
359
+            $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************');
360
+        } else {
361
+            $this->appendDebug($this->wsdl->getDebug());
362
+            $this->wsdl->clearDebug();
363
+            $this->debug('getOperations returned false');
364
+            $this->setError('no operations defined in the WSDL document!');
365
+        }
366
+    }
367 367
 
368
-	/**
369
-	 * instantiate wsdl object and parse wsdl file
370
-	 *
371
-	 * @access	public
372
-	 */
373
-	function loadWSDL() {
374
-		$this->debug('instantiating wsdl class with doc: '.$this->wsdlFile);
375
-		$this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl);
376
-		$this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest);
377
-		$this->wsdl->fetchWSDL($this->wsdlFile);
378
-		$this->checkWSDL();
379
-	}
368
+    /**
369
+     * instantiate wsdl object and parse wsdl file
370
+     *
371
+     * @access	public
372
+     */
373
+    function loadWSDL() {
374
+        $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile);
375
+        $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl);
376
+        $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest);
377
+        $this->wsdl->fetchWSDL($this->wsdlFile);
378
+        $this->checkWSDL();
379
+    }
380 380
 
381
-	/**
382
-	* get available data pertaining to an operation
383
-	*
384
-	* @param    string $operation operation name
385
-	* @return	array array of data pertaining to the operation
386
-	* @access   public
387
-	*/
388
-	function getOperationData($operation){
389
-		if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
390
-			$this->loadWSDL();
391
-			if ($this->getError())
392
-				return false;
393
-		}
394
-		if(isset($this->operations[$operation])){
395
-			return $this->operations[$operation];
396
-		}
397
-		$this->debug("No data for operation: $operation");
398
-	}
381
+    /**
382
+     * get available data pertaining to an operation
383
+     *
384
+     * @param    string $operation operation name
385
+     * @return	array array of data pertaining to the operation
386
+     * @access   public
387
+     */
388
+    function getOperationData($operation){
389
+        if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
390
+            $this->loadWSDL();
391
+            if ($this->getError())
392
+                return false;
393
+        }
394
+        if(isset($this->operations[$operation])){
395
+            return $this->operations[$operation];
396
+        }
397
+        $this->debug("No data for operation: $operation");
398
+    }
399 399
 
400 400
     /**
401
-    * send the SOAP message
402
-    *
403
-    * Note: if the operation has multiple return values
404
-    * the return value of this method will be an array
405
-    * of those values.
406
-    *
407
-	* @param    string $msg a SOAPx4 soapmsg object
408
-	* @param    string $soapaction SOAPAction value
409
-	* @param    integer $timeout set connection timeout in seconds
410
-	* @param	integer $response_timeout set response timeout in seconds
411
-	* @return	mixed native PHP types.
412
-	* @access   private
413
-	*/
414
-	function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
415
-		$this->checkCookies();
416
-		// detect transport
417
-		switch(true){
418
-			// http(s)
419
-			case preg_match('/^http/',$this->endpoint):
420
-				$this->debug('transporting via HTTP');
421
-				if($this->persistentConnection == true && is_object($this->persistentConnection)){
422
-					$http =& $this->persistentConnection;
423
-				} else {
424
-					$http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl);
425
-					if ($this->persistentConnection) {
426
-						$http->usePersistentConnection();
427
-					}
428
-				}
429
-				$http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
430
-				$http->setSOAPAction($soapaction);
431
-				if($this->proxyhost && $this->proxyport){
432
-					$http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
433
-				}
401
+     * send the SOAP message
402
+     *
403
+     * Note: if the operation has multiple return values
404
+     * the return value of this method will be an array
405
+     * of those values.
406
+     *
407
+     * @param    string $msg a SOAPx4 soapmsg object
408
+     * @param    string $soapaction SOAPAction value
409
+     * @param    integer $timeout set connection timeout in seconds
410
+     * @param	integer $response_timeout set response timeout in seconds
411
+     * @return	mixed native PHP types.
412
+     * @access   private
413
+     */
414
+    function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
415
+        $this->checkCookies();
416
+        // detect transport
417
+        switch(true){
418
+            // http(s)
419
+            case preg_match('/^http/',$this->endpoint):
420
+                $this->debug('transporting via HTTP');
421
+                if($this->persistentConnection == true && is_object($this->persistentConnection)){
422
+                    $http =& $this->persistentConnection;
423
+                } else {
424
+                    $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl);
425
+                    if ($this->persistentConnection) {
426
+                        $http->usePersistentConnection();
427
+                    }
428
+                }
429
+                $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
430
+                $http->setSOAPAction($soapaction);
431
+                if($this->proxyhost && $this->proxyport){
432
+                    $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
433
+                }
434 434
                 if($this->authtype != '') {
435
-					$http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
436
-				}
437
-				if($this->http_encoding != ''){
438
-					$http->setEncoding($this->http_encoding);
439
-				}
440
-				$this->debug('sending message, length='.strlen($msg));
441
-				if(preg_match('/^http:/',$this->endpoint)){
442
-				//if(strpos($this->endpoint,'http:')){
443
-					$this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
444
-				} elseif(preg_match('/^https/',$this->endpoint)){
445
-				//} elseif(strpos($this->endpoint,'https:')){
446
-					//if(phpversion() == '4.3.0-dev'){
447
-						//$response = $http->send($msg,$timeout,$response_timeout);
448
-                   		//$this->request = $http->outgoing_payload;
449
-						//$this->response = $http->incoming_payload;
450
-					//} else
451
-					$this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
452
-				} else {
453
-					$this->setError('no http/s in endpoint url');
454
-				}
455
-				$this->request = $http->outgoing_payload;
456
-				$this->response = $http->incoming_payload;
457
-				$this->appendDebug($http->getDebug());
458
-				$this->UpdateCookies($http->incoming_cookies);
459
-
460
-				// save transport object if using persistent connections
461
-				if ($this->persistentConnection) {
462
-					$http->clearDebug();
463
-					if (!is_object($this->persistentConnection)) {
464
-						$this->persistentConnection = $http;
465
-					}
466
-				}
435
+                    $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
436
+                }
437
+                if($this->http_encoding != ''){
438
+                    $http->setEncoding($this->http_encoding);
439
+                }
440
+                $this->debug('sending message, length='.strlen($msg));
441
+                if(preg_match('/^http:/',$this->endpoint)){
442
+                //if(strpos($this->endpoint,'http:')){
443
+                    $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
444
+                } elseif(preg_match('/^https/',$this->endpoint)){
445
+                //} elseif(strpos($this->endpoint,'https:')){
446
+                    //if(phpversion() == '4.3.0-dev'){
447
+                        //$response = $http->send($msg,$timeout,$response_timeout);
448
+                            //$this->request = $http->outgoing_payload;
449
+                        //$this->response = $http->incoming_payload;
450
+                    //} else
451
+                    $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
452
+                } else {
453
+                    $this->setError('no http/s in endpoint url');
454
+                }
455
+                $this->request = $http->outgoing_payload;
456
+                $this->response = $http->incoming_payload;
457
+                $this->appendDebug($http->getDebug());
458
+                $this->UpdateCookies($http->incoming_cookies);
459
+
460
+                // save transport object if using persistent connections
461
+                if ($this->persistentConnection) {
462
+                    $http->clearDebug();
463
+                    if (!is_object($this->persistentConnection)) {
464
+                        $this->persistentConnection = $http;
465
+                    }
466
+                }
467 467
 				
468
-				if($err = $http->getError()){
469
-					$this->setError('HTTP Error: '.$err);
470
-					return false;
471
-				} elseif($this->getError()){
472
-					return false;
473
-				} else {
474
-					$this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']);
475
-					return $this->parseResponse($http->incoming_headers, $this->responseData);
476
-				}
477
-			break;
478
-			default:
479
-				$this->setError('no transport found, or selected transport is not yet supported!');
480
-			return false;
481
-			break;
482
-		}
483
-	}
468
+                if($err = $http->getError()){
469
+                    $this->setError('HTTP Error: '.$err);
470
+                    return false;
471
+                } elseif($this->getError()){
472
+                    return false;
473
+                } else {
474
+                    $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']);
475
+                    return $this->parseResponse($http->incoming_headers, $this->responseData);
476
+                }
477
+            break;
478
+            default:
479
+                $this->setError('no transport found, or selected transport is not yet supported!');
480
+            return false;
481
+            break;
482
+        }
483
+    }
484 484
 
485
-	/**
486
-	* processes SOAP message returned from server
487
-	*
488
-	* @param	array	$headers	The HTTP headers
489
-	* @param	string	$data		unprocessed response data from server
490
-	* @return	mixed	value of the message, decoded into a PHP type
491
-	* @access   private
492
-	*/
485
+    /**
486
+     * processes SOAP message returned from server
487
+     *
488
+     * @param	array	$headers	The HTTP headers
489
+     * @param	string	$data		unprocessed response data from server
490
+     * @return	mixed	value of the message, decoded into a PHP type
491
+     * @access   private
492
+     */
493 493
     function parseResponse($headers, $data) {
494
-		$this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:');
495
-		$this->appendDebug($this->varDump($headers));
496
-    	if (!isset($headers['content-type'])) {
497
-			$this->setError('Response not of type text/xml (no content-type header)');
498
-			return false;
499
-    	}
500
-		if (!strstr($headers['content-type'], 'text/xml')) {
501
-			$this->setError('Response not of type text/xml: ' . $headers['content-type']);
502
-			return false;
503
-		}
504
-		if (strpos($headers['content-type'], '=')) {
505
-			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
506
-			$this->debug('Got response encoding: ' . $enc);
507
-			if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
508
-				$this->xml_encoding = strtoupper($enc);
509
-			} else {
510
-				$this->xml_encoding = 'US-ASCII';
511
-			}
512
-		} else {
513
-			// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
514
-			$this->xml_encoding = 'ISO-8859-1';
515
-		}
516
-		$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
517
-		$parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
518
-		// add parser debug data to our debug
519
-		$this->appendDebug($parser->getDebug());
520
-		// if parse errors
521
-		if($errstr = $parser->getError()){
522
-			$this->setError( $errstr);
523
-			// destroy the parser object
524
-			unset($parser);
525
-			return false;
526
-		} else {
527
-			// get SOAP headers
528
-			$this->responseHeaders = $parser->getHeaders();
529
-			// get SOAP headers
530
-			$this->responseHeader = $parser->get_soapheader();
531
-			// get decoded message
532
-			$return = $parser->get_soapbody();
494
+        $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:');
495
+        $this->appendDebug($this->varDump($headers));
496
+        if (!isset($headers['content-type'])) {
497
+            $this->setError('Response not of type text/xml (no content-type header)');
498
+            return false;
499
+        }
500
+        if (!strstr($headers['content-type'], 'text/xml')) {
501
+            $this->setError('Response not of type text/xml: ' . $headers['content-type']);
502
+            return false;
503
+        }
504
+        if (strpos($headers['content-type'], '=')) {
505
+            $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
506
+            $this->debug('Got response encoding: ' . $enc);
507
+            if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
508
+                $this->xml_encoding = strtoupper($enc);
509
+            } else {
510
+                $this->xml_encoding = 'US-ASCII';
511
+            }
512
+        } else {
513
+            // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
514
+            $this->xml_encoding = 'ISO-8859-1';
515
+        }
516
+        $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
517
+        $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
518
+        // add parser debug data to our debug
519
+        $this->appendDebug($parser->getDebug());
520
+        // if parse errors
521
+        if($errstr = $parser->getError()){
522
+            $this->setError( $errstr);
523
+            // destroy the parser object
524
+            unset($parser);
525
+            return false;
526
+        } else {
527
+            // get SOAP headers
528
+            $this->responseHeaders = $parser->getHeaders();
529
+            // get SOAP headers
530
+            $this->responseHeader = $parser->get_soapheader();
531
+            // get decoded message
532
+            $return = $parser->get_soapbody();
533 533
             // add document for doclit support
534 534
             $this->document = $parser->document;
535
-			// destroy the parser object
536
-			unset($parser);
537
-			// return decode message
538
-			return $return;
539
-		}
540
-	 }
541
-
542
-	/**
543
-	* sets user-specified cURL options
544
-	*
545
-	* @param	mixed $option The cURL option (always integer?)
546
-	* @param	mixed $value The cURL option value
547
-	* @access   public
548
-	*/
549
-	function setCurlOption($option, $value) {
550
-		$this->debug("setCurlOption option=$option, value=");
551
-		$this->appendDebug($this->varDump($value));
552
-		$this->curl_options[$option] = $value;
553
-	}
535
+            // destroy the parser object
536
+            unset($parser);
537
+            // return decode message
538
+            return $return;
539
+        }
540
+        }
554 541
 
555
-	/**
556
-	* sets the SOAP endpoint, which can override WSDL
557
-	*
558
-	* @param	string $endpoint The endpoint URL to use, or empty string or false to prevent override
559
-	* @access   public
560
-	*/
561
-	function setEndpoint($endpoint) {
562
-		$this->debug("setEndpoint(\"$endpoint\")");
563
-		$this->forceEndpoint = $endpoint;
564
-	}
542
+    /**
543
+     * sets user-specified cURL options
544
+     *
545
+     * @param	mixed $option The cURL option (always integer?)
546
+     * @param	mixed $value The cURL option value
547
+     * @access   public
548
+     */
549
+    function setCurlOption($option, $value) {
550
+        $this->debug("setCurlOption option=$option, value=");
551
+        $this->appendDebug($this->varDump($value));
552
+        $this->curl_options[$option] = $value;
553
+    }
565 554
 
566
-	/**
567
-	* set the SOAP headers
568
-	*
569
-	* @param	mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers
570
-	* @access   public
571
-	*/
572
-	function setHeaders($headers){
573
-		$this->debug("setHeaders headers=");
574
-		$this->appendDebug($this->varDump($headers));
575
-		$this->requestHeaders = $headers;
576
-	}
555
+    /**
556
+     * sets the SOAP endpoint, which can override WSDL
557
+     *
558
+     * @param	string $endpoint The endpoint URL to use, or empty string or false to prevent override
559
+     * @access   public
560
+     */
561
+    function setEndpoint($endpoint) {
562
+        $this->debug("setEndpoint(\"$endpoint\")");
563
+        $this->forceEndpoint = $endpoint;
564
+    }
577 565
 
578
-	/**
579
-	* get the SOAP response headers (namespace resolution incomplete)
580
-	*
581
-	* @return	string
582
-	* @access   public
583
-	*/
584
-	function getHeaders(){
585
-		return $this->responseHeaders;
586
-	}
566
+    /**
567
+     * set the SOAP headers
568
+     *
569
+     * @param	mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers
570
+     * @access   public
571
+     */
572
+    function setHeaders($headers){
573
+        $this->debug("setHeaders headers=");
574
+        $this->appendDebug($this->varDump($headers));
575
+        $this->requestHeaders = $headers;
576
+    }
587 577
 
588
-	/**
589
-	* get the SOAP response Header (parsed)
590
-	*
591
-	* @return	mixed
592
-	* @access   public
593
-	*/
594
-	function getHeader(){
595
-		return $this->responseHeader;
596
-	}
578
+    /**
579
+     * get the SOAP response headers (namespace resolution incomplete)
580
+     *
581
+     * @return	string
582
+     * @access   public
583
+     */
584
+    function getHeaders(){
585
+        return $this->responseHeaders;
586
+    }
597 587
 
598
-	/**
599
-	* set proxy info here
600
-	*
601
-	* @param    string $proxyhost
602
-	* @param    string $proxyport
603
-	* @param	string $proxyusername
604
-	* @param	string $proxypassword
605
-	* @access   public
606
-	*/
607
-	function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
608
-		$this->proxyhost = $proxyhost;
609
-		$this->proxyport = $proxyport;
610
-		$this->proxyusername = $proxyusername;
611
-		$this->proxypassword = $proxypassword;
612
-	}
588
+    /**
589
+     * get the SOAP response Header (parsed)
590
+     *
591
+     * @return	mixed
592
+     * @access   public
593
+     */
594
+    function getHeader(){
595
+        return $this->responseHeader;
596
+    }
613 597
 
614
-	/**
615
-	* if authenticating, set user credentials here
616
-	*
617
-	* @param    string $username
618
-	* @param    string $password
619
-	* @param	string $authtype (basic|digest|certificate|ntlm)
620
-	* @param	array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
621
-	* @access   public
622
-	*/
623
-	function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) {
624
-		$this->debug("setCredentials username=$username authtype=$authtype certRequest=");
625
-		$this->appendDebug($this->varDump($certRequest));
626
-		$this->username = $username;
627
-		$this->password = $password;
628
-		$this->authtype = $authtype;
629
-		$this->certRequest = $certRequest;
630
-	}
598
+    /**
599
+     * set proxy info here
600
+     *
601
+     * @param    string $proxyhost
602
+     * @param    string $proxyport
603
+     * @param	string $proxyusername
604
+     * @param	string $proxypassword
605
+     * @access   public
606
+     */
607
+    function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
608
+        $this->proxyhost = $proxyhost;
609
+        $this->proxyport = $proxyport;
610
+        $this->proxyusername = $proxyusername;
611
+        $this->proxypassword = $proxypassword;
612
+    }
613
+
614
+    /**
615
+     * if authenticating, set user credentials here
616
+     *
617
+     * @param    string $username
618
+     * @param    string $password
619
+     * @param	string $authtype (basic|digest|certificate|ntlm)
620
+     * @param	array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
621
+     * @access   public
622
+     */
623
+    function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) {
624
+        $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
625
+        $this->appendDebug($this->varDump($certRequest));
626
+        $this->username = $username;
627
+        $this->password = $password;
628
+        $this->authtype = $authtype;
629
+        $this->certRequest = $certRequest;
630
+    }
631 631
 	
632
-	/**
633
-	* use HTTP encoding
634
-	*
635
-	* @param    string $enc HTTP encoding
636
-	* @access   public
637
-	*/
638
-	function setHTTPEncoding($enc='gzip, deflate'){
639
-		$this->debug("setHTTPEncoding(\"$enc\")");
640
-		$this->http_encoding = $enc;
641
-	}
632
+    /**
633
+     * use HTTP encoding
634
+     *
635
+     * @param    string $enc HTTP encoding
636
+     * @access   public
637
+     */
638
+    function setHTTPEncoding($enc='gzip, deflate'){
639
+        $this->debug("setHTTPEncoding(\"$enc\")");
640
+        $this->http_encoding = $enc;
641
+    }
642 642
 	
643
-	/**
644
-	* Set whether to try to use cURL connections if possible
645
-	*
646
-	* @param	boolean $use Whether to try to use cURL
647
-	* @access   public
648
-	*/
649
-	function setUseCURL($use) {
650
-		$this->debug("setUseCURL($use)");
651
-		$this->use_curl = $use;
652
-	}
643
+    /**
644
+     * Set whether to try to use cURL connections if possible
645
+     *
646
+     * @param	boolean $use Whether to try to use cURL
647
+     * @access   public
648
+     */
649
+    function setUseCURL($use) {
650
+        $this->debug("setUseCURL($use)");
651
+        $this->use_curl = $use;
652
+    }
653 653
 
654
-	/**
655
-	* use HTTP persistent connections if possible
656
-	*
657
-	* @access   public
658
-	*/
659
-	function useHTTPPersistentConnection(){
660
-		$this->debug("useHTTPPersistentConnection");
661
-		$this->persistentConnection = true;
662
-	}
654
+    /**
655
+     * use HTTP persistent connections if possible
656
+     *
657
+     * @access   public
658
+     */
659
+    function useHTTPPersistentConnection(){
660
+        $this->debug("useHTTPPersistentConnection");
661
+        $this->persistentConnection = true;
662
+    }
663 663
 	
664
-	/**
665
-	* gets the default RPC parameter setting.
666
-	* If true, default is that call params are like RPC even for document style.
667
-	* Each call() can override this value.
668
-	*
669
-	* This is no longer used.
670
-	*
671
-	* @return boolean
672
-	* @access public
673
-	* @deprecated
674
-	*/
675
-	function getDefaultRpcParams() {
676
-		return $this->defaultRpcParams;
677
-	}
664
+    /**
665
+     * gets the default RPC parameter setting.
666
+     * If true, default is that call params are like RPC even for document style.
667
+     * Each call() can override this value.
668
+     *
669
+     * This is no longer used.
670
+     *
671
+     * @return boolean
672
+     * @access public
673
+     * @deprecated
674
+     */
675
+    function getDefaultRpcParams() {
676
+        return $this->defaultRpcParams;
677
+    }
678 678
 
679
-	/**
680
-	* sets the default RPC parameter setting.
681
-	* If true, default is that call params are like RPC even for document style
682
-	* Each call() can override this value.
683
-	*
684
-	* This is no longer used.
685
-	*
686
-	* @param    boolean $rpcParams
687
-	* @access public
688
-	* @deprecated
689
-	*/
690
-	function setDefaultRpcParams($rpcParams) {
691
-		$this->defaultRpcParams = $rpcParams;
692
-	}
679
+    /**
680
+     * sets the default RPC parameter setting.
681
+     * If true, default is that call params are like RPC even for document style
682
+     * Each call() can override this value.
683
+     *
684
+     * This is no longer used.
685
+     *
686
+     * @param    boolean $rpcParams
687
+     * @access public
688
+     * @deprecated
689
+     */
690
+    function setDefaultRpcParams($rpcParams) {
691
+        $this->defaultRpcParams = $rpcParams;
692
+    }
693 693
 	
694
-	/**
695
-	* dynamically creates an instance of a proxy class,
696
-	* allowing user to directly call methods from wsdl
697
-	*
698
-	* @return   object soap_proxy object
699
-	* @access   public
700
-	*/
701
-	function getProxy() {
702
-		$r = rand();
703
-		$evalStr = $this->_getProxyClassCode($r);
704
-		//$this->debug("proxy class: $evalStr");
705
-		if ($this->getError()) {
706
-			$this->debug("Error from _getProxyClassCode, so return NULL");
707
-			return null;
708
-		}
709
-		// eval the class
710
-		eval($evalStr);
711
-		// instantiate proxy object
712
-		eval("\$proxy = new nusoap_proxy_$r('');");
713
-		// transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice
714
-		$proxy->endpointType = 'wsdl';
715
-		$proxy->wsdlFile = $this->wsdlFile;
716
-		$proxy->wsdl = $this->wsdl;
717
-		$proxy->operations = $this->operations;
718
-		$proxy->defaultRpcParams = $this->defaultRpcParams;
719
-		// transfer other state
720
-		$proxy->soap_defencoding = $this->soap_defencoding;
721
-		$proxy->username = $this->username;
722
-		$proxy->password = $this->password;
723
-		$proxy->authtype = $this->authtype;
724
-		$proxy->certRequest = $this->certRequest;
725
-		$proxy->requestHeaders = $this->requestHeaders;
726
-		$proxy->endpoint = $this->endpoint;
727
-		$proxy->forceEndpoint = $this->forceEndpoint;
728
-		$proxy->proxyhost = $this->proxyhost;
729
-		$proxy->proxyport = $this->proxyport;
730
-		$proxy->proxyusername = $this->proxyusername;
731
-		$proxy->proxypassword = $this->proxypassword;
732
-		$proxy->http_encoding = $this->http_encoding;
733
-		$proxy->timeout = $this->timeout;
734
-		$proxy->response_timeout = $this->response_timeout;
735
-		$proxy->persistentConnection = &$this->persistentConnection;
736
-		$proxy->decode_utf8 = $this->decode_utf8;
737
-		$proxy->curl_options = $this->curl_options;
738
-		$proxy->bindingType = $this->bindingType;
739
-		$proxy->use_curl = $this->use_curl;
740
-		return $proxy;
741
-	}
694
+    /**
695
+     * dynamically creates an instance of a proxy class,
696
+     * allowing user to directly call methods from wsdl
697
+     *
698
+     * @return   object soap_proxy object
699
+     * @access   public
700
+     */
701
+    function getProxy() {
702
+        $r = rand();
703
+        $evalStr = $this->_getProxyClassCode($r);
704
+        //$this->debug("proxy class: $evalStr");
705
+        if ($this->getError()) {
706
+            $this->debug("Error from _getProxyClassCode, so return NULL");
707
+            return null;
708
+        }
709
+        // eval the class
710
+        eval($evalStr);
711
+        // instantiate proxy object
712
+        eval("\$proxy = new nusoap_proxy_$r('');");
713
+        // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice
714
+        $proxy->endpointType = 'wsdl';
715
+        $proxy->wsdlFile = $this->wsdlFile;
716
+        $proxy->wsdl = $this->wsdl;
717
+        $proxy->operations = $this->operations;
718
+        $proxy->defaultRpcParams = $this->defaultRpcParams;
719
+        // transfer other state
720
+        $proxy->soap_defencoding = $this->soap_defencoding;
721
+        $proxy->username = $this->username;
722
+        $proxy->password = $this->password;
723
+        $proxy->authtype = $this->authtype;
724
+        $proxy->certRequest = $this->certRequest;
725
+        $proxy->requestHeaders = $this->requestHeaders;
726
+        $proxy->endpoint = $this->endpoint;
727
+        $proxy->forceEndpoint = $this->forceEndpoint;
728
+        $proxy->proxyhost = $this->proxyhost;
729
+        $proxy->proxyport = $this->proxyport;
730
+        $proxy->proxyusername = $this->proxyusername;
731
+        $proxy->proxypassword = $this->proxypassword;
732
+        $proxy->http_encoding = $this->http_encoding;
733
+        $proxy->timeout = $this->timeout;
734
+        $proxy->response_timeout = $this->response_timeout;
735
+        $proxy->persistentConnection = &$this->persistentConnection;
736
+        $proxy->decode_utf8 = $this->decode_utf8;
737
+        $proxy->curl_options = $this->curl_options;
738
+        $proxy->bindingType = $this->bindingType;
739
+        $proxy->use_curl = $this->use_curl;
740
+        return $proxy;
741
+    }
742 742
 
743
-	/**
744
-	* dynamically creates proxy class code
745
-	*
746
-	* @return   string PHP/NuSOAP code for the proxy class
747
-	* @access   private
748
-	*/
749
-	function _getProxyClassCode($r) {
750
-		$this->debug("in getProxy endpointType=$this->endpointType");
751
-		$this->appendDebug("wsdl=" . $this->varDump($this->wsdl));
752
-		if ($this->endpointType != 'wsdl') {
753
-			$evalStr = 'A proxy can only be created for a WSDL client';
754
-			$this->setError($evalStr);
755
-			$evalStr = "echo \"$evalStr\";";
756
-			return $evalStr;
757
-		}
758
-		if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
759
-			$this->loadWSDL();
760
-			if ($this->getError()) {
761
-				return "echo \"" . $this->getError() . "\";";
762
-			}
763
-		}
764
-		$evalStr = '';
765
-		foreach ($this->operations as $operation => $opData) {
766
-			if ($operation != '') {
767
-				// create param string and param comment string
768
-				if (sizeof($opData['input']['parts']) > 0) {
769
-					$paramStr = '';
770
-					$paramArrayStr = '';
771
-					$paramCommentStr = '';
772
-					foreach ($opData['input']['parts'] as $name => $type) {
773
-						$paramStr .= "\$$name, ";
774
-						$paramArrayStr .= "'$name' => \$$name, ";
775
-						$paramCommentStr .= "$type \$$name, ";
776
-					}
777
-					$paramStr = substr($paramStr, 0, strlen($paramStr)-2);
778
-					$paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2);
779
-					$paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2);
780
-				} else {
781
-					$paramStr = '';
782
-					$paramArrayStr = '';
783
-					$paramCommentStr = 'void';
784
-				}
785
-				$opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
786
-				$evalStr .= "// $paramCommentStr
743
+    /**
744
+     * dynamically creates proxy class code
745
+     *
746
+     * @return   string PHP/NuSOAP code for the proxy class
747
+     * @access   private
748
+     */
749
+    function _getProxyClassCode($r) {
750
+        $this->debug("in getProxy endpointType=$this->endpointType");
751
+        $this->appendDebug("wsdl=" . $this->varDump($this->wsdl));
752
+        if ($this->endpointType != 'wsdl') {
753
+            $evalStr = 'A proxy can only be created for a WSDL client';
754
+            $this->setError($evalStr);
755
+            $evalStr = "echo \"$evalStr\";";
756
+            return $evalStr;
757
+        }
758
+        if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
759
+            $this->loadWSDL();
760
+            if ($this->getError()) {
761
+                return "echo \"" . $this->getError() . "\";";
762
+            }
763
+        }
764
+        $evalStr = '';
765
+        foreach ($this->operations as $operation => $opData) {
766
+            if ($operation != '') {
767
+                // create param string and param comment string
768
+                if (sizeof($opData['input']['parts']) > 0) {
769
+                    $paramStr = '';
770
+                    $paramArrayStr = '';
771
+                    $paramCommentStr = '';
772
+                    foreach ($opData['input']['parts'] as $name => $type) {
773
+                        $paramStr .= "\$$name, ";
774
+                        $paramArrayStr .= "'$name' => \$$name, ";
775
+                        $paramCommentStr .= "$type \$$name, ";
776
+                    }
777
+                    $paramStr = substr($paramStr, 0, strlen($paramStr)-2);
778
+                    $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2);
779
+                    $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2);
780
+                } else {
781
+                    $paramStr = '';
782
+                    $paramArrayStr = '';
783
+                    $paramCommentStr = 'void';
784
+                }
785
+                $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
786
+                $evalStr .= "// $paramCommentStr
787 787
 	function " . str_replace('.', '__', $operation) . "($paramStr) {
788 788
 		\$params = array($paramArrayStr);
789 789
 		return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."');
790 790
 	}
791 791
 	";
792
-				unset($paramStr);
793
-				unset($paramCommentStr);
794
-			}
795
-		}
796
-		$evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client {
792
+                unset($paramStr);
793
+                unset($paramCommentStr);
794
+            }
795
+        }
796
+        $evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client {
797 797
 	'.$evalStr.'
798 798
 }';
799
-		return $evalStr;
800
-	}
799
+        return $evalStr;
800
+    }
801 801
 
802
-	/**
803
-	* dynamically creates proxy class code
804
-	*
805
-	* @return   string PHP/NuSOAP code for the proxy class
806
-	* @access   public
807
-	*/
808
-	function getProxyClassCode() {
809
-		$r = rand();
810
-		return $this->_getProxyClassCode($r);
811
-	}
802
+    /**
803
+     * dynamically creates proxy class code
804
+     *
805
+     * @return   string PHP/NuSOAP code for the proxy class
806
+     * @access   public
807
+     */
808
+    function getProxyClassCode() {
809
+        $r = rand();
810
+        return $this->_getProxyClassCode($r);
811
+    }
812 812
 
813
-	/**
814
-	* gets the HTTP body for the current request.
815
-	*
816
-	* @param string $soapmsg The SOAP payload
817
-	* @return string The HTTP body, which includes the SOAP payload
818
-	* @access private
819
-	*/
820
-	function getHTTPBody($soapmsg) {
821
-		return $soapmsg;
822
-	}
813
+    /**
814
+     * gets the HTTP body for the current request.
815
+     *
816
+     * @param string $soapmsg The SOAP payload
817
+     * @return string The HTTP body, which includes the SOAP payload
818
+     * @access private
819
+     */
820
+    function getHTTPBody($soapmsg) {
821
+        return $soapmsg;
822
+    }
823 823
 	
824
-	/**
825
-	* gets the HTTP content type for the current request.
826
-	*
827
-	* Note: getHTTPBody must be called before this.
828
-	*
829
-	* @return string the HTTP content type for the current request.
830
-	* @access private
831
-	*/
832
-	function getHTTPContentType() {
833
-		return 'text/xml';
834
-	}
824
+    /**
825
+     * gets the HTTP content type for the current request.
826
+     *
827
+     * Note: getHTTPBody must be called before this.
828
+     *
829
+     * @return string the HTTP content type for the current request.
830
+     * @access private
831
+     */
832
+    function getHTTPContentType() {
833
+        return 'text/xml';
834
+    }
835 835
 	
836
-	/**
837
-	* gets the HTTP content type charset for the current request.
838
-	* returns false for non-text content types.
839
-	*
840
-	* Note: getHTTPBody must be called before this.
841
-	*
842
-	* @return string the HTTP content type charset for the current request.
843
-	* @access private
844
-	*/
845
-	function getHTTPContentTypeCharset() {
846
-		return $this->soap_defencoding;
847
-	}
836
+    /**
837
+     * gets the HTTP content type charset for the current request.
838
+     * returns false for non-text content types.
839
+     *
840
+     * Note: getHTTPBody must be called before this.
841
+     *
842
+     * @return string the HTTP content type charset for the current request.
843
+     * @access private
844
+     */
845
+    function getHTTPContentTypeCharset() {
846
+        return $this->soap_defencoding;
847
+    }
848 848
 
849
-	/*
849
+    /*
850 850
 	* whether or not parser should decode utf8 element content
851 851
     *
852 852
     * @return   always returns true
853 853
     * @access   public
854 854
     */
855 855
     function decodeUTF8($bool){
856
-		$this->decode_utf8 = $bool;
857
-		return true;
856
+        $this->decode_utf8 = $bool;
857
+        return true;
858 858
     }
859 859
 
860
-	/**
861
-	 * adds a new Cookie into $this->cookies array
862
-	 *
863
-	 * @param	string $name Cookie Name
864
-	 * @param	string $value Cookie Value
865
-	 * @return	boolean if cookie-set was successful returns true, else false
866
-	 * @access	public
867
-	 */
868
-	function setCookie($name, $value) {
869
-		if (strlen($name) == 0) {
870
-			return false;
871
-		}
872
-		$this->cookies[] = array('name' => $name, 'value' => $value);
873
-		return true;
874
-	}
860
+    /**
861
+     * adds a new Cookie into $this->cookies array
862
+     *
863
+     * @param	string $name Cookie Name
864
+     * @param	string $value Cookie Value
865
+     * @return	boolean if cookie-set was successful returns true, else false
866
+     * @access	public
867
+     */
868
+    function setCookie($name, $value) {
869
+        if (strlen($name) == 0) {
870
+            return false;
871
+        }
872
+        $this->cookies[] = array('name' => $name, 'value' => $value);
873
+        return true;
874
+    }
875 875
 
876
-	/**
877
-	 * gets all Cookies
878
-	 *
879
-	 * @return   array with all internal cookies
880
-	 * @access   public
881
-	 */
882
-	function getCookies() {
883
-		return $this->cookies;
884
-	}
876
+    /**
877
+     * gets all Cookies
878
+     *
879
+     * @return   array with all internal cookies
880
+     * @access   public
881
+     */
882
+    function getCookies() {
883
+        return $this->cookies;
884
+    }
885 885
 
886
-	/**
887
-	 * checks all Cookies and delete those which are expired
888
-	 *
889
-	 * @return   boolean always return true
890
-	 * @access   private
891
-	 */
892
-	function checkCookies() {
893
-		if (sizeof($this->cookies) == 0) {
894
-			return true;
895
-		}
896
-		$this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
897
-		$curr_cookies = $this->cookies;
898
-		$this->cookies = array();
899
-		foreach ($curr_cookies as $cookie) {
900
-			if (! is_array($cookie)) {
901
-				$this->debug('Remove cookie that is not an array');
902
-				continue;
903
-			}
904
-			if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
905
-				if (strtotime($cookie['expires']) > time()) {
906
-					$this->cookies[] = $cookie;
907
-				} else {
908
-					$this->debug('Remove expired cookie ' . $cookie['name']);
909
-				}
910
-			} else {
911
-				$this->cookies[] = $cookie;
912
-			}
913
-		}
914
-		$this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array');
915
-		return true;
916
-	}
886
+    /**
887
+     * checks all Cookies and delete those which are expired
888
+     *
889
+     * @return   boolean always return true
890
+     * @access   private
891
+     */
892
+    function checkCookies() {
893
+        if (sizeof($this->cookies) == 0) {
894
+            return true;
895
+        }
896
+        $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
897
+        $curr_cookies = $this->cookies;
898
+        $this->cookies = array();
899
+        foreach ($curr_cookies as $cookie) {
900
+            if (! is_array($cookie)) {
901
+                $this->debug('Remove cookie that is not an array');
902
+                continue;
903
+            }
904
+            if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
905
+                if (strtotime($cookie['expires']) > time()) {
906
+                    $this->cookies[] = $cookie;
907
+                } else {
908
+                    $this->debug('Remove expired cookie ' . $cookie['name']);
909
+                }
910
+            } else {
911
+                $this->cookies[] = $cookie;
912
+            }
913
+        }
914
+        $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array');
915
+        return true;
916
+    }
917 917
 
918
-	/**
919
-	 * updates the current cookies with a new set
920
-	 *
921
-	 * @param	array $cookies new cookies with which to update current ones
922
-	 * @return	boolean always return true
923
-	 * @access	private
924
-	 */
925
-	function UpdateCookies($cookies) {
926
-		if (sizeof($this->cookies) == 0) {
927
-			// no existing cookies: take whatever is new
928
-			if (sizeof($cookies) > 0) {
929
-				$this->debug('Setting new cookie(s)');
930
-				$this->cookies = $cookies;
931
-			}
932
-			return true;
933
-		}
934
-		if (sizeof($cookies) == 0) {
935
-			// no new cookies: keep what we've got
936
-			return true;
937
-		}
938
-		// merge
939
-		foreach ($cookies as $newCookie) {
940
-			if (!is_array($newCookie)) {
941
-				continue;
942
-			}
943
-			if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
944
-				continue;
945
-			}
946
-			$newName = $newCookie['name'];
947
-
948
-			$found = false;
949
-			for ($i = 0; $i < count($this->cookies); $i++) {
950
-				$cookie = $this->cookies[$i];
951
-				if (!is_array($cookie)) {
952
-					continue;
953
-				}
954
-				if (!isset($cookie['name'])) {
955
-					continue;
956
-				}
957
-				if ($newName != $cookie['name']) {
958
-					continue;
959
-				}
960
-				$newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
961
-				$domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
962
-				if ($newDomain != $domain) {
963
-					continue;
964
-				}
965
-				$newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
966
-				$path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
967
-				if ($newPath != $path) {
968
-					continue;
969
-				}
970
-				$this->cookies[$i] = $newCookie;
971
-				$found = true;
972
-				$this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
973
-				break;
974
-			}
975
-			if (! $found) {
976
-				$this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
977
-				$this->cookies[] = $newCookie;
978
-			}
979
-		}
980
-		return true;
981
-	}
918
+    /**
919
+     * updates the current cookies with a new set
920
+     *
921
+     * @param	array $cookies new cookies with which to update current ones
922
+     * @return	boolean always return true
923
+     * @access	private
924
+     */
925
+    function UpdateCookies($cookies) {
926
+        if (sizeof($this->cookies) == 0) {
927
+            // no existing cookies: take whatever is new
928
+            if (sizeof($cookies) > 0) {
929
+                $this->debug('Setting new cookie(s)');
930
+                $this->cookies = $cookies;
931
+            }
932
+            return true;
933
+        }
934
+        if (sizeof($cookies) == 0) {
935
+            // no new cookies: keep what we've got
936
+            return true;
937
+        }
938
+        // merge
939
+        foreach ($cookies as $newCookie) {
940
+            if (!is_array($newCookie)) {
941
+                continue;
942
+            }
943
+            if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
944
+                continue;
945
+            }
946
+            $newName = $newCookie['name'];
947
+
948
+            $found = false;
949
+            for ($i = 0; $i < count($this->cookies); $i++) {
950
+                $cookie = $this->cookies[$i];
951
+                if (!is_array($cookie)) {
952
+                    continue;
953
+                }
954
+                if (!isset($cookie['name'])) {
955
+                    continue;
956
+                }
957
+                if ($newName != $cookie['name']) {
958
+                    continue;
959
+                }
960
+                $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
961
+                $domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
962
+                if ($newDomain != $domain) {
963
+                    continue;
964
+                }
965
+                $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
966
+                $path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
967
+                if ($newPath != $path) {
968
+                    continue;
969
+                }
970
+                $this->cookies[$i] = $newCookie;
971
+                $found = true;
972
+                $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
973
+                break;
974
+            }
975
+            if (! $found) {
976
+                $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
977
+                $this->cookies[] = $newCookie;
978
+            }
979
+        }
980
+        return true;
981
+    }
982 982
 }
983 983
 
984 984
 if (!extension_loaded('soap')) {
985
-	/**
986
-	 *	For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded.
987
-	 */
988
-	class soapclient extends nusoap_client {
989
-	}
985
+    /**
986
+     *	For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded.
987
+     */
988
+    class soapclient extends nusoap_client {
989
+    }
990 990
 }
991 991
 ?>
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_server.php 1 patch
Indentation   +1023 added lines, -1023 removed lines patch added patch discarded remove patch
@@ -14,1076 +14,1076 @@  discard block
 block discarded – undo
14 14
 * @access   public
15 15
 */
16 16
 class nusoap_server extends nusoap_base {
17
-	/**
18
-	 * HTTP headers of request
19
-	 * @var array
20
-	 * @access private
21
-	 */
22
-	var $headers = array();
23
-	/**
24
-	 * HTTP request
25
-	 * @var string
26
-	 * @access private
27
-	 */
28
-	var $request = '';
29
-	/**
30
-	 * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text)
31
-	 * @var string
32
-	 * @access public
33
-	 */
34
-	var $requestHeaders = '';
35
-	/**
36
-	 * SOAP Headers from request (parsed)
37
-	 * @var mixed
38
-	 * @access public
39
-	 */
40
-	var $requestHeader = NULL;
41
-	/**
42
-	 * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text)
43
-	 * @var string
44
-	 * @access public
45
-	 */
46
-	var $document = '';
47
-	/**
48
-	 * SOAP payload for request (text)
49
-	 * @var string
50
-	 * @access public
51
-	 */
52
-	var $requestSOAP = '';
53
-	/**
54
-	 * requested method namespace URI
55
-	 * @var string
56
-	 * @access private
57
-	 */
58
-	var $methodURI = '';
59
-	/**
60
-	 * name of method requested
61
-	 * @var string
62
-	 * @access private
63
-	 */
64
-	var $methodname = '';
65
-	/**
66
-	 * method parameters from request
67
-	 * @var array
68
-	 * @access private
69
-	 */
70
-	var $methodparams = array();
71
-	/**
72
-	 * SOAP Action from request
73
-	 * @var string
74
-	 * @access private
75
-	 */
76
-	var $SOAPAction = '';
77
-	/**
78
-	 * character set encoding of incoming (request) messages
79
-	 * @var string
80
-	 * @access public
81
-	 */
82
-	var $xml_encoding = '';
83
-	/**
84
-	 * toggles whether the parser decodes element content w/ utf8_decode()
85
-	 * @var boolean
86
-	 * @access public
87
-	 */
17
+    /**
18
+     * HTTP headers of request
19
+     * @var array
20
+     * @access private
21
+     */
22
+    var $headers = array();
23
+    /**
24
+     * HTTP request
25
+     * @var string
26
+     * @access private
27
+     */
28
+    var $request = '';
29
+    /**
30
+     * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text)
31
+     * @var string
32
+     * @access public
33
+     */
34
+    var $requestHeaders = '';
35
+    /**
36
+     * SOAP Headers from request (parsed)
37
+     * @var mixed
38
+     * @access public
39
+     */
40
+    var $requestHeader = NULL;
41
+    /**
42
+     * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text)
43
+     * @var string
44
+     * @access public
45
+     */
46
+    var $document = '';
47
+    /**
48
+     * SOAP payload for request (text)
49
+     * @var string
50
+     * @access public
51
+     */
52
+    var $requestSOAP = '';
53
+    /**
54
+     * requested method namespace URI
55
+     * @var string
56
+     * @access private
57
+     */
58
+    var $methodURI = '';
59
+    /**
60
+     * name of method requested
61
+     * @var string
62
+     * @access private
63
+     */
64
+    var $methodname = '';
65
+    /**
66
+     * method parameters from request
67
+     * @var array
68
+     * @access private
69
+     */
70
+    var $methodparams = array();
71
+    /**
72
+     * SOAP Action from request
73
+     * @var string
74
+     * @access private
75
+     */
76
+    var $SOAPAction = '';
77
+    /**
78
+     * character set encoding of incoming (request) messages
79
+     * @var string
80
+     * @access public
81
+     */
82
+    var $xml_encoding = '';
83
+    /**
84
+     * toggles whether the parser decodes element content w/ utf8_decode()
85
+     * @var boolean
86
+     * @access public
87
+     */
88 88
     var $decode_utf8 = true;
89 89
 
90
-	/**
91
-	 * HTTP headers of response
92
-	 * @var array
93
-	 * @access public
94
-	 */
95
-	var $outgoing_headers = array();
96
-	/**
97
-	 * HTTP response
98
-	 * @var string
99
-	 * @access private
100
-	 */
101
-	var $response = '';
102
-	/**
103
-	 * SOAP headers for response (text or array of soapval or associative array)
104
-	 * @var mixed
105
-	 * @access public
106
-	 */
107
-	var $responseHeaders = '';
108
-	/**
109
-	 * SOAP payload for response (text)
110
-	 * @var string
111
-	 * @access private
112
-	 */
113
-	var $responseSOAP = '';
114
-	/**
115
-	 * method return value to place in response
116
-	 * @var mixed
117
-	 * @access private
118
-	 */
119
-	var $methodreturn = false;
120
-	/**
121
-	 * whether $methodreturn is a string of literal XML
122
-	 * @var boolean
123
-	 * @access public
124
-	 */
125
-	var $methodreturnisliteralxml = false;
126
-	/**
127
-	 * SOAP fault for response (or false)
128
-	 * @var mixed
129
-	 * @access private
130
-	 */
131
-	var $fault = false;
132
-	/**
133
-	 * text indication of result (for debugging)
134
-	 * @var string
135
-	 * @access private
136
-	 */
137
-	var $result = 'successful';
90
+    /**
91
+     * HTTP headers of response
92
+     * @var array
93
+     * @access public
94
+     */
95
+    var $outgoing_headers = array();
96
+    /**
97
+     * HTTP response
98
+     * @var string
99
+     * @access private
100
+     */
101
+    var $response = '';
102
+    /**
103
+     * SOAP headers for response (text or array of soapval or associative array)
104
+     * @var mixed
105
+     * @access public
106
+     */
107
+    var $responseHeaders = '';
108
+    /**
109
+     * SOAP payload for response (text)
110
+     * @var string
111
+     * @access private
112
+     */
113
+    var $responseSOAP = '';
114
+    /**
115
+     * method return value to place in response
116
+     * @var mixed
117
+     * @access private
118
+     */
119
+    var $methodreturn = false;
120
+    /**
121
+     * whether $methodreturn is a string of literal XML
122
+     * @var boolean
123
+     * @access public
124
+     */
125
+    var $methodreturnisliteralxml = false;
126
+    /**
127
+     * SOAP fault for response (or false)
128
+     * @var mixed
129
+     * @access private
130
+     */
131
+    var $fault = false;
132
+    /**
133
+     * text indication of result (for debugging)
134
+     * @var string
135
+     * @access private
136
+     */
137
+    var $result = 'successful';
138 138
 
139
-	/**
140
-	 * assoc array of operations => opData; operations are added by the register()
141
-	 * method or by parsing an external WSDL definition
142
-	 * @var array
143
-	 * @access private
144
-	 */
145
-	var $operations = array();
146
-	/**
147
-	 * wsdl instance (if one)
148
-	 * @var mixed
149
-	 * @access private
150
-	 */
151
-	var $wsdl = false;
152
-	/**
153
-	 * URL for WSDL (if one)
154
-	 * @var mixed
155
-	 * @access private
156
-	 */
157
-	var $externalWSDLURL = false;
158
-	/**
159
-	 * whether to append debug to response as XML comment
160
-	 * @var boolean
161
-	 * @access public
162
-	 */
163
-	var $debug_flag = false;
139
+    /**
140
+     * assoc array of operations => opData; operations are added by the register()
141
+     * method or by parsing an external WSDL definition
142
+     * @var array
143
+     * @access private
144
+     */
145
+    var $operations = array();
146
+    /**
147
+     * wsdl instance (if one)
148
+     * @var mixed
149
+     * @access private
150
+     */
151
+    var $wsdl = false;
152
+    /**
153
+     * URL for WSDL (if one)
154
+     * @var mixed
155
+     * @access private
156
+     */
157
+    var $externalWSDLURL = false;
158
+    /**
159
+     * whether to append debug to response as XML comment
160
+     * @var boolean
161
+     * @access public
162
+     */
163
+    var $debug_flag = false;
164 164
 
165 165
 
166
-	/**
167
-	* constructor
168
-    * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
169
-	*
170
-    * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
171
-	* @access   public
172
-	*/
173
-	function nusoap_server($wsdl=false){
174
-		parent::nusoap_base();
175
-		// turn on debugging?
176
-		global $debug;
177
-		global $HTTP_SERVER_VARS;
166
+    /**
167
+     * constructor
168
+     * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
169
+     *
170
+     * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
171
+     * @access   public
172
+     */
173
+    function nusoap_server($wsdl=false){
174
+        parent::nusoap_base();
175
+        // turn on debugging?
176
+        global $debug;
177
+        global $HTTP_SERVER_VARS;
178 178
 
179
-		if (isset($_SERVER)) {
180
-			$this->debug("_SERVER is defined:");
181
-			$this->appendDebug($this->varDump($_SERVER));
182
-		} elseif (isset($HTTP_SERVER_VARS)) {
183
-			$this->debug("HTTP_SERVER_VARS is defined:");
184
-			$this->appendDebug($this->varDump($HTTP_SERVER_VARS));
185
-		} else {
186
-			$this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
187
-		}
179
+        if (isset($_SERVER)) {
180
+            $this->debug("_SERVER is defined:");
181
+            $this->appendDebug($this->varDump($_SERVER));
182
+        } elseif (isset($HTTP_SERVER_VARS)) {
183
+            $this->debug("HTTP_SERVER_VARS is defined:");
184
+            $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
185
+        } else {
186
+            $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
187
+        }
188 188
 
189
-		if (isset($debug)) {
190
-			$this->debug("In nusoap_server, set debug_flag=$debug based on global flag");
191
-			$this->debug_flag = $debug;
192
-		} elseif (isset($_SERVER['QUERY_STRING'])) {
193
-			$qs = explode('&', $_SERVER['QUERY_STRING']);
194
-			foreach ($qs as $v) {
195
-				if (substr($v, 0, 6) == 'debug=') {
196
-					$this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
197
-					$this->debug_flag = substr($v, 6);
198
-				}
199
-			}
200
-		} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
201
-			$qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
202
-			foreach ($qs as $v) {
203
-				if (substr($v, 0, 6) == 'debug=') {
204
-					$this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
205
-					$this->debug_flag = substr($v, 6);
206
-				}
207
-			}
208
-		}
189
+        if (isset($debug)) {
190
+            $this->debug("In nusoap_server, set debug_flag=$debug based on global flag");
191
+            $this->debug_flag = $debug;
192
+        } elseif (isset($_SERVER['QUERY_STRING'])) {
193
+            $qs = explode('&', $_SERVER['QUERY_STRING']);
194
+            foreach ($qs as $v) {
195
+                if (substr($v, 0, 6) == 'debug=') {
196
+                    $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
197
+                    $this->debug_flag = substr($v, 6);
198
+                }
199
+            }
200
+        } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
201
+            $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
202
+            foreach ($qs as $v) {
203
+                if (substr($v, 0, 6) == 'debug=') {
204
+                    $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
205
+                    $this->debug_flag = substr($v, 6);
206
+                }
207
+            }
208
+        }
209 209
 
210
-		// wsdl
211
-		if($wsdl){
212
-			$this->debug("In nusoap_server, WSDL is specified");
213
-			if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
214
-				$this->wsdl = $wsdl;
215
-				$this->externalWSDLURL = $this->wsdl->wsdl;
216
-				$this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
217
-			} else {
218
-				$this->debug('Create wsdl from ' . $wsdl);
219
-				$this->wsdl = new wsdl($wsdl);
220
-				$this->externalWSDLURL = $wsdl;
221
-			}
222
-			$this->appendDebug($this->wsdl->getDebug());
223
-			$this->wsdl->clearDebug();
224
-			if($err = $this->wsdl->getError()){
225
-				die('WSDL ERROR: '.$err);
226
-			}
227
-		}
228
-	}
210
+        // wsdl
211
+        if($wsdl){
212
+            $this->debug("In nusoap_server, WSDL is specified");
213
+            if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
214
+                $this->wsdl = $wsdl;
215
+                $this->externalWSDLURL = $this->wsdl->wsdl;
216
+                $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
217
+            } else {
218
+                $this->debug('Create wsdl from ' . $wsdl);
219
+                $this->wsdl = new wsdl($wsdl);
220
+                $this->externalWSDLURL = $wsdl;
221
+            }
222
+            $this->appendDebug($this->wsdl->getDebug());
223
+            $this->wsdl->clearDebug();
224
+            if($err = $this->wsdl->getError()){
225
+                die('WSDL ERROR: '.$err);
226
+            }
227
+        }
228
+    }
229 229
 
230
-	/**
231
-	* processes request and returns response
232
-	*
233
-	* @param    string $data usually is the value of $HTTP_RAW_POST_DATA
234
-	* @access   public
235
-	*/
236
-	function service($data){
237
-		global $HTTP_SERVER_VARS;
230
+    /**
231
+     * processes request and returns response
232
+     *
233
+     * @param    string $data usually is the value of $HTTP_RAW_POST_DATA
234
+     * @access   public
235
+     */
236
+    function service($data){
237
+        global $HTTP_SERVER_VARS;
238 238
 
239
-		if (isset($_SERVER['REQUEST_METHOD'])) {
240
-			$rm = $_SERVER['REQUEST_METHOD'];
241
-		} elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) {
242
-			$rm = $HTTP_SERVER_VARS['REQUEST_METHOD'];
243
-		} else {
244
-			$rm = '';
245
-		}
239
+        if (isset($_SERVER['REQUEST_METHOD'])) {
240
+            $rm = $_SERVER['REQUEST_METHOD'];
241
+        } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) {
242
+            $rm = $HTTP_SERVER_VARS['REQUEST_METHOD'];
243
+        } else {
244
+            $rm = '';
245
+        }
246 246
 
247
-		if (isset($_SERVER['QUERY_STRING'])) {
248
-			$qs = $_SERVER['QUERY_STRING'];
249
-		} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
250
-			$qs = $HTTP_SERVER_VARS['QUERY_STRING'];
251
-		} else {
252
-			$qs = '';
253
-		}
254
-		$this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data));
247
+        if (isset($_SERVER['QUERY_STRING'])) {
248
+            $qs = $_SERVER['QUERY_STRING'];
249
+        } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
250
+            $qs = $HTTP_SERVER_VARS['QUERY_STRING'];
251
+        } else {
252
+            $qs = '';
253
+        }
254
+        $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data));
255 255
 
256
-		if ($rm == 'POST') {
257
-			$this->debug("In service, invoke the request");
258
-			$this->parse_request($data);
259
-			if (! $this->fault) {
260
-				$this->invoke_method();
261
-			}
262
-			if (! $this->fault) {
263
-				$this->serialize_return();
264
-			}
265
-			$this->send_response();
266
-		} elseif (preg_match('/wsdl/', $qs) ){
267
-			$this->debug("In service, this is a request for WSDL");
268
-			if ($this->externalWSDLURL){
269
-              if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL
270
-				$this->debug("In service, re-direct for WSDL");
271
-				header('Location: '.$this->externalWSDLURL);
272
-              } else { // assume file
273
-				$this->debug("In service, use file passthru for WSDL");
256
+        if ($rm == 'POST') {
257
+            $this->debug("In service, invoke the request");
258
+            $this->parse_request($data);
259
+            if (! $this->fault) {
260
+                $this->invoke_method();
261
+            }
262
+            if (! $this->fault) {
263
+                $this->serialize_return();
264
+            }
265
+            $this->send_response();
266
+        } elseif (preg_match('/wsdl/', $qs) ){
267
+            $this->debug("In service, this is a request for WSDL");
268
+            if ($this->externalWSDLURL){
269
+                if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL
270
+                $this->debug("In service, re-direct for WSDL");
271
+                header('Location: '.$this->externalWSDLURL);
272
+                } else { // assume file
273
+                $this->debug("In service, use file passthru for WSDL");
274 274
                 header("Content-Type: text/xml\r\n");
275
-				$pos = strpos($this->externalWSDLURL, "file://");
276
-				if ($pos === false) {
277
-					$filename = $this->externalWSDLURL;
278
-				} else {
279
-					$filename = substr($this->externalWSDLURL, $pos + 7);
280
-				}
275
+                $pos = strpos($this->externalWSDLURL, "file://");
276
+                if ($pos === false) {
277
+                    $filename = $this->externalWSDLURL;
278
+                } else {
279
+                    $filename = substr($this->externalWSDLURL, $pos + 7);
280
+                }
281 281
                 $fp = fopen($this->externalWSDLURL, 'r');
282 282
                 fpassthru($fp);
283
-              }
284
-			} elseif ($this->wsdl) {
285
-				$this->debug("In service, serialize WSDL");
286
-				header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
287
-				print $this->wsdl->serialize($this->debug_flag);
288
-				if ($this->debug_flag) {
289
-					$this->debug('wsdl:');
290
-					$this->appendDebug($this->varDump($this->wsdl));
291
-					print $this->getDebugAsXMLComment();
292
-				}
293
-			} else {
294
-				$this->debug("In service, there is no WSDL");
295
-				header("Content-Type: text/html; charset=ISO-8859-1\r\n");
296
-				print "This service does not provide WSDL";
297
-			}
298
-		} elseif ($this->wsdl) {
299
-			$this->debug("In service, return Web description");
300
-			print $this->wsdl->webDescription();
301
-		} else {
302
-			$this->debug("In service, no Web description");
303
-			header("Content-Type: text/html; charset=ISO-8859-1\r\n");
304
-			print "This service does not provide a Web description";
305
-		}
306
-	}
283
+                }
284
+            } elseif ($this->wsdl) {
285
+                $this->debug("In service, serialize WSDL");
286
+                header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
287
+                print $this->wsdl->serialize($this->debug_flag);
288
+                if ($this->debug_flag) {
289
+                    $this->debug('wsdl:');
290
+                    $this->appendDebug($this->varDump($this->wsdl));
291
+                    print $this->getDebugAsXMLComment();
292
+                }
293
+            } else {
294
+                $this->debug("In service, there is no WSDL");
295
+                header("Content-Type: text/html; charset=ISO-8859-1\r\n");
296
+                print "This service does not provide WSDL";
297
+            }
298
+        } elseif ($this->wsdl) {
299
+            $this->debug("In service, return Web description");
300
+            print $this->wsdl->webDescription();
301
+        } else {
302
+            $this->debug("In service, no Web description");
303
+            header("Content-Type: text/html; charset=ISO-8859-1\r\n");
304
+            print "This service does not provide a Web description";
305
+        }
306
+    }
307 307
 
308
-	/**
309
-	* parses HTTP request headers.
310
-	*
311
-	* The following fields are set by this function (when successful)
312
-	*
313
-	* headers
314
-	* request
315
-	* xml_encoding
316
-	* SOAPAction
317
-	*
318
-	* @access   private
319
-	*/
320
-	function parse_http_headers() {
321
-		global $HTTP_SERVER_VARS;
308
+    /**
309
+     * parses HTTP request headers.
310
+     *
311
+     * The following fields are set by this function (when successful)
312
+     *
313
+     * headers
314
+     * request
315
+     * xml_encoding
316
+     * SOAPAction
317
+     *
318
+     * @access   private
319
+     */
320
+    function parse_http_headers() {
321
+        global $HTTP_SERVER_VARS;
322 322
 
323
-		$this->request = '';
324
-		$this->SOAPAction = '';
325
-		if(function_exists('getallheaders')){
326
-			$this->debug("In parse_http_headers, use getallheaders");
327
-			$headers = getallheaders();
328
-			foreach($headers as $k=>$v){
329
-				$k = strtolower($k);
330
-				$this->headers[$k] = $v;
331
-				$this->request .= "$k: $v\r\n";
332
-				$this->debug("$k: $v");
333
-			}
334
-			// get SOAPAction header
335
-			if(isset($this->headers['soapaction'])){
336
-				$this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
337
-			}
338
-			// get the character encoding of the incoming request
339
-			if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
340
-				$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
341
-				if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
342
-					$this->xml_encoding = strtoupper($enc);
343
-				} else {
344
-					$this->xml_encoding = 'US-ASCII';
345
-				}
346
-			} else {
347
-				// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
348
-				$this->xml_encoding = 'ISO-8859-1';
349
-			}
350
-		} elseif(isset($_SERVER) && is_array($_SERVER)){
351
-			$this->debug("In parse_http_headers, use _SERVER");
352
-			foreach ($_SERVER as $k => $v) {
353
-				if (substr($k, 0, 5) == 'HTTP_') {
354
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
355
-				} else {
356
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
357
-				}
358
-				if ($k == 'soapaction') {
359
-					// get SOAPAction header
360
-					$k = 'SOAPAction';
361
-					$v = str_replace('"', '', $v);
362
-					$v = str_replace('\\', '', $v);
363
-					$this->SOAPAction = $v;
364
-				} else if ($k == 'content-type') {
365
-					// get the character encoding of the incoming request
366
-					if (strpos($v, '=')) {
367
-						$enc = substr(strstr($v, '='), 1);
368
-						$enc = str_replace('"', '', $enc);
369
-						$enc = str_replace('\\', '', $enc);
370
-						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
371
-							$this->xml_encoding = strtoupper($enc);
372
-						} else {
373
-							$this->xml_encoding = 'US-ASCII';
374
-						}
375
-					} else {
376
-						// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
377
-						$this->xml_encoding = 'ISO-8859-1';
378
-					}
379
-				}
380
-				$this->headers[$k] = $v;
381
-				$this->request .= "$k: $v\r\n";
382
-				$this->debug("$k: $v");
383
-			}
384
-		} elseif (is_array($HTTP_SERVER_VARS)) {
385
-			$this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
386
-			foreach ($HTTP_SERVER_VARS as $k => $v) {
387
-				if (substr($k, 0, 5) == 'HTTP_') {
388
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); 	                                         $k = strtolower(substr($k, 5));
389
-				} else {
390
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); 	                                         $k = strtolower($k);
391
-				}
392
-				if ($k == 'soapaction') {
393
-					// get SOAPAction header
394
-					$k = 'SOAPAction';
395
-					$v = str_replace('"', '', $v);
396
-					$v = str_replace('\\', '', $v);
397
-					$this->SOAPAction = $v;
398
-				} else if ($k == 'content-type') {
399
-					// get the character encoding of the incoming request
400
-					if (strpos($v, '=')) {
401
-						$enc = substr(strstr($v, '='), 1);
402
-						$enc = str_replace('"', '', $enc);
403
-						$enc = str_replace('\\', '', $enc);
404
-						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
405
-							$this->xml_encoding = strtoupper($enc);
406
-						} else {
407
-							$this->xml_encoding = 'US-ASCII';
408
-						}
409
-					} else {
410
-						// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
411
-						$this->xml_encoding = 'ISO-8859-1';
412
-					}
413
-				}
414
-				$this->headers[$k] = $v;
415
-				$this->request .= "$k: $v\r\n";
416
-				$this->debug("$k: $v");
417
-			}
418
-		} else {
419
-			$this->debug("In parse_http_headers, HTTP headers not accessible");
420
-			$this->setError("HTTP headers not accessible");
421
-		}
422
-	}
323
+        $this->request = '';
324
+        $this->SOAPAction = '';
325
+        if(function_exists('getallheaders')){
326
+            $this->debug("In parse_http_headers, use getallheaders");
327
+            $headers = getallheaders();
328
+            foreach($headers as $k=>$v){
329
+                $k = strtolower($k);
330
+                $this->headers[$k] = $v;
331
+                $this->request .= "$k: $v\r\n";
332
+                $this->debug("$k: $v");
333
+            }
334
+            // get SOAPAction header
335
+            if(isset($this->headers['soapaction'])){
336
+                $this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
337
+            }
338
+            // get the character encoding of the incoming request
339
+            if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
340
+                $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
341
+                if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
342
+                    $this->xml_encoding = strtoupper($enc);
343
+                } else {
344
+                    $this->xml_encoding = 'US-ASCII';
345
+                }
346
+            } else {
347
+                // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
348
+                $this->xml_encoding = 'ISO-8859-1';
349
+            }
350
+        } elseif(isset($_SERVER) && is_array($_SERVER)){
351
+            $this->debug("In parse_http_headers, use _SERVER");
352
+            foreach ($_SERVER as $k => $v) {
353
+                if (substr($k, 0, 5) == 'HTTP_') {
354
+                    $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
355
+                } else {
356
+                    $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
357
+                }
358
+                if ($k == 'soapaction') {
359
+                    // get SOAPAction header
360
+                    $k = 'SOAPAction';
361
+                    $v = str_replace('"', '', $v);
362
+                    $v = str_replace('\\', '', $v);
363
+                    $this->SOAPAction = $v;
364
+                } else if ($k == 'content-type') {
365
+                    // get the character encoding of the incoming request
366
+                    if (strpos($v, '=')) {
367
+                        $enc = substr(strstr($v, '='), 1);
368
+                        $enc = str_replace('"', '', $enc);
369
+                        $enc = str_replace('\\', '', $enc);
370
+                        if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
371
+                            $this->xml_encoding = strtoupper($enc);
372
+                        } else {
373
+                            $this->xml_encoding = 'US-ASCII';
374
+                        }
375
+                    } else {
376
+                        // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
377
+                        $this->xml_encoding = 'ISO-8859-1';
378
+                    }
379
+                }
380
+                $this->headers[$k] = $v;
381
+                $this->request .= "$k: $v\r\n";
382
+                $this->debug("$k: $v");
383
+            }
384
+        } elseif (is_array($HTTP_SERVER_VARS)) {
385
+            $this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
386
+            foreach ($HTTP_SERVER_VARS as $k => $v) {
387
+                if (substr($k, 0, 5) == 'HTTP_') {
388
+                    $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); 	                                         $k = strtolower(substr($k, 5));
389
+                } else {
390
+                    $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); 	                                         $k = strtolower($k);
391
+                }
392
+                if ($k == 'soapaction') {
393
+                    // get SOAPAction header
394
+                    $k = 'SOAPAction';
395
+                    $v = str_replace('"', '', $v);
396
+                    $v = str_replace('\\', '', $v);
397
+                    $this->SOAPAction = $v;
398
+                } else if ($k == 'content-type') {
399
+                    // get the character encoding of the incoming request
400
+                    if (strpos($v, '=')) {
401
+                        $enc = substr(strstr($v, '='), 1);
402
+                        $enc = str_replace('"', '', $enc);
403
+                        $enc = str_replace('\\', '', $enc);
404
+                        if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
405
+                            $this->xml_encoding = strtoupper($enc);
406
+                        } else {
407
+                            $this->xml_encoding = 'US-ASCII';
408
+                        }
409
+                    } else {
410
+                        // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
411
+                        $this->xml_encoding = 'ISO-8859-1';
412
+                    }
413
+                }
414
+                $this->headers[$k] = $v;
415
+                $this->request .= "$k: $v\r\n";
416
+                $this->debug("$k: $v");
417
+            }
418
+        } else {
419
+            $this->debug("In parse_http_headers, HTTP headers not accessible");
420
+            $this->setError("HTTP headers not accessible");
421
+        }
422
+    }
423 423
 
424
-	/**
425
-	* parses a request
426
-	*
427
-	* The following fields are set by this function (when successful)
428
-	*
429
-	* headers
430
-	* request
431
-	* xml_encoding
432
-	* SOAPAction
433
-	* request
434
-	* requestSOAP
435
-	* methodURI
436
-	* methodname
437
-	* methodparams
438
-	* requestHeaders
439
-	* document
440
-	*
441
-	* This sets the fault field on error
442
-	*
443
-	* @param    string $data XML string
444
-	* @access   private
445
-	*/
446
-	function parse_request($data='') {
447
-		$this->debug('entering parse_request()');
448
-		$this->parse_http_headers();
449
-		$this->debug('got character encoding: '.$this->xml_encoding);
450
-		// uncompress if necessary
451
-		if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
452
-			$this->debug('got content encoding: ' . $this->headers['content-encoding']);
453
-			if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
454
-		    	// if decoding works, use it. else assume data wasn't gzencoded
455
-				if (function_exists('gzuncompress')) {
456
-					if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
457
-						$data = $degzdata;
458
-					} elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) {
459
-						$data = $degzdata;
460
-					} else {
461
-						$this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data');
462
-						return;
463
-					}
464
-				} else {
465
-					$this->fault('SOAP-ENV:Client', 'This Server does not support compressed data');
466
-					return;
467
-				}
468
-			}
469
-		}
470
-		$this->request .= "\r\n".$data;
471
-		$data = $this->parseRequest($this->headers, $data);
472
-		$this->requestSOAP = $data;
473
-		$this->debug('leaving parse_request');
474
-	}
424
+    /**
425
+     * parses a request
426
+     *
427
+     * The following fields are set by this function (when successful)
428
+     *
429
+     * headers
430
+     * request
431
+     * xml_encoding
432
+     * SOAPAction
433
+     * request
434
+     * requestSOAP
435
+     * methodURI
436
+     * methodname
437
+     * methodparams
438
+     * requestHeaders
439
+     * document
440
+     *
441
+     * This sets the fault field on error
442
+     *
443
+     * @param    string $data XML string
444
+     * @access   private
445
+     */
446
+    function parse_request($data='') {
447
+        $this->debug('entering parse_request()');
448
+        $this->parse_http_headers();
449
+        $this->debug('got character encoding: '.$this->xml_encoding);
450
+        // uncompress if necessary
451
+        if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
452
+            $this->debug('got content encoding: ' . $this->headers['content-encoding']);
453
+            if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
454
+                // if decoding works, use it. else assume data wasn't gzencoded
455
+                if (function_exists('gzuncompress')) {
456
+                    if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
457
+                        $data = $degzdata;
458
+                    } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) {
459
+                        $data = $degzdata;
460
+                    } else {
461
+                        $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data');
462
+                        return;
463
+                    }
464
+                } else {
465
+                    $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data');
466
+                    return;
467
+                }
468
+            }
469
+        }
470
+        $this->request .= "\r\n".$data;
471
+        $data = $this->parseRequest($this->headers, $data);
472
+        $this->requestSOAP = $data;
473
+        $this->debug('leaving parse_request');
474
+    }
475 475
 
476
-	/**
477
-	* invokes a PHP function for the requested SOAP method
478
-	*
479
-	* The following fields are set by this function (when successful)
480
-	*
481
-	* methodreturn
482
-	*
483
-	* Note that the PHP function that is called may also set the following
484
-	* fields to affect the response sent to the client
485
-	*
486
-	* responseHeaders
487
-	* outgoing_headers
488
-	*
489
-	* This sets the fault field on error
490
-	*
491
-	* @access   private
492
-	*/
493
-	function invoke_method() {
494
-		$this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
476
+    /**
477
+     * invokes a PHP function for the requested SOAP method
478
+     *
479
+     * The following fields are set by this function (when successful)
480
+     *
481
+     * methodreturn
482
+     *
483
+     * Note that the PHP function that is called may also set the following
484
+     * fields to affect the response sent to the client
485
+     *
486
+     * responseHeaders
487
+     * outgoing_headers
488
+     *
489
+     * This sets the fault field on error
490
+     *
491
+     * @access   private
492
+     */
493
+    function invoke_method() {
494
+        $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
495 495
 
496
-		//
497
-		// if you are debugging in this area of the code, your service uses a class to implement methods,
498
-		// you use SOAP RPC, and the client is .NET, please be aware of the following...
499
-		// when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the
500
-		// method name.  that is fine for naming the .NET methods.  it is not fine for properly constructing
501
-		// the XML request and reading the XML response.  you need to add the RequestElementName and
502
-		// ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe
503
-		// generates for the method.  these parameters are used to specify the correct XML element names
504
-		// for .NET to use, i.e. the names with the '.' in them.
505
-		//
506
-		$orig_methodname = $this->methodname;
507
-		if ($this->wsdl) {
508
-			if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
509
-				$this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
510
-				$this->appendDebug('opData=' . $this->varDump($this->opData));
511
-			} elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
512
-				// Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
513
-				$this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
514
-				$this->appendDebug('opData=' . $this->varDump($this->opData));
515
-				$this->methodname = $this->opData['name'];
516
-			} else {
517
-				$this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
518
-				$this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
519
-				return;
520
-			}
521
-		} else {
522
-			$this->debug('in invoke_method, no WSDL to validate method');
523
-		}
496
+        //
497
+        // if you are debugging in this area of the code, your service uses a class to implement methods,
498
+        // you use SOAP RPC, and the client is .NET, please be aware of the following...
499
+        // when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the
500
+        // method name.  that is fine for naming the .NET methods.  it is not fine for properly constructing
501
+        // the XML request and reading the XML response.  you need to add the RequestElementName and
502
+        // ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe
503
+        // generates for the method.  these parameters are used to specify the correct XML element names
504
+        // for .NET to use, i.e. the names with the '.' in them.
505
+        //
506
+        $orig_methodname = $this->methodname;
507
+        if ($this->wsdl) {
508
+            if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
509
+                $this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
510
+                $this->appendDebug('opData=' . $this->varDump($this->opData));
511
+            } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
512
+                // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
513
+                $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
514
+                $this->appendDebug('opData=' . $this->varDump($this->opData));
515
+                $this->methodname = $this->opData['name'];
516
+            } else {
517
+                $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
518
+                $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
519
+                return;
520
+            }
521
+        } else {
522
+            $this->debug('in invoke_method, no WSDL to validate method');
523
+        }
524 524
 
525
-		// if a . is present in $this->methodname, we see if there is a class in scope,
526
-		// which could be referred to. We will also distinguish between two deliminators,
527
-		// to allow methods to be called a the class or an instance
528
-		if (strpos($this->methodname, '..') > 0) {
529
-			$delim = '..';
530
-		} else if (strpos($this->methodname, '.') > 0) {
531
-			$delim = '.';
532
-		} else {
533
-			$delim = '';
534
-		}
535
-		$this->debug("in invoke_method, delim=$delim");
525
+        // if a . is present in $this->methodname, we see if there is a class in scope,
526
+        // which could be referred to. We will also distinguish between two deliminators,
527
+        // to allow methods to be called a the class or an instance
528
+        if (strpos($this->methodname, '..') > 0) {
529
+            $delim = '..';
530
+        } else if (strpos($this->methodname, '.') > 0) {
531
+            $delim = '.';
532
+        } else {
533
+            $delim = '';
534
+        }
535
+        $this->debug("in invoke_method, delim=$delim");
536 536
 
537
-		$class = '';
538
-		$method = '';
539
-		if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) {
540
-			$try_class = substr($this->methodname, 0, strpos($this->methodname, $delim));
541
-			if (class_exists($try_class)) {
542
-				// get the class and method name
543
-				$class = $try_class;
544
-				$method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
545
-				$this->debug("in invoke_method, class=$class method=$method delim=$delim");
546
-			} else {
547
-				$this->debug("in invoke_method, class=$try_class not found");
548
-			}
549
-		} else {
550
-			$try_class = '';
551
-			$this->debug("in invoke_method, no class to try");
552
-		}
537
+        $class = '';
538
+        $method = '';
539
+        if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) {
540
+            $try_class = substr($this->methodname, 0, strpos($this->methodname, $delim));
541
+            if (class_exists($try_class)) {
542
+                // get the class and method name
543
+                $class = $try_class;
544
+                $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
545
+                $this->debug("in invoke_method, class=$class method=$method delim=$delim");
546
+            } else {
547
+                $this->debug("in invoke_method, class=$try_class not found");
548
+            }
549
+        } else {
550
+            $try_class = '';
551
+            $this->debug("in invoke_method, no class to try");
552
+        }
553 553
 
554
-		// does method exist?
555
-		if ($class == '') {
556
-			if (!function_exists($this->methodname)) {
557
-				$this->debug("in invoke_method, function '$this->methodname' not found!");
558
-				$this->result = 'fault: method not found';
559
-				$this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')");
560
-				return;
561
-			}
562
-		} else {
563
-			$method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method;
564
-			if (!in_array($method_to_compare, get_class_methods($class))) {
565
-				$this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
566
-				$this->result = 'fault: method not found';
567
-				$this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')");
568
-				return;
569
-			}
570
-		}
554
+        // does method exist?
555
+        if ($class == '') {
556
+            if (!function_exists($this->methodname)) {
557
+                $this->debug("in invoke_method, function '$this->methodname' not found!");
558
+                $this->result = 'fault: method not found';
559
+                $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')");
560
+                return;
561
+            }
562
+        } else {
563
+            $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method;
564
+            if (!in_array($method_to_compare, get_class_methods($class))) {
565
+                $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
566
+                $this->result = 'fault: method not found';
567
+                $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')");
568
+                return;
569
+            }
570
+        }
571 571
 
572
-		// evaluate message, getting back parameters
573
-		// verify that request parameters match the method's signature
574
-		if(! $this->verify_method($this->methodname,$this->methodparams)){
575
-			// debug
576
-			$this->debug('ERROR: request not verified against method signature');
577
-			$this->result = 'fault: request failed validation against method signature';
578
-			// return fault
579
-			$this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service.");
580
-			return;
581
-		}
572
+        // evaluate message, getting back parameters
573
+        // verify that request parameters match the method's signature
574
+        if(! $this->verify_method($this->methodname,$this->methodparams)){
575
+            // debug
576
+            $this->debug('ERROR: request not verified against method signature');
577
+            $this->result = 'fault: request failed validation against method signature';
578
+            // return fault
579
+            $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service.");
580
+            return;
581
+        }
582 582
 
583
-		// if there are parameters to pass
584
-		$this->debug('in invoke_method, params:');
585
-		$this->appendDebug($this->varDump($this->methodparams));
586
-		$this->debug("in invoke_method, calling '$this->methodname'");
587
-		if (!function_exists('call_user_func_array')) {
588
-			if ($class == '') {
589
-				$this->debug('in invoke_method, calling function using eval()');
590
-				$funcCall = "\$this->methodreturn = $this->methodname(";
591
-			} else {
592
-				if ($delim == '..') {
593
-					$this->debug('in invoke_method, calling class method using eval()');
594
-					$funcCall = "\$this->methodreturn = ".$class."::".$method."(";
595
-				} else {
596
-					$this->debug('in invoke_method, calling instance method using eval()');
597
-					// generate unique instance name
598
-					$instname = "\$inst_".time();
599
-					$funcCall = $instname." = new ".$class."(); ";
600
-					$funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
601
-				}
602
-			}
603
-			if ($this->methodparams) {
604
-				foreach ($this->methodparams as $param) {
605
-					if (is_array($param) || is_object($param)) {
606
-						$this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
607
-						return;
608
-					}
609
-					$funcCall .= "\"$param\",";
610
-				}
611
-				$funcCall = substr($funcCall, 0, -1);
612
-			}
613
-			$funcCall .= ');';
614
-			$this->debug('in invoke_method, function call: '.$funcCall);
615
-			@eval($funcCall);
616
-		} else {
617
-			if ($class == '') {
618
-				$this->debug('in invoke_method, calling function using call_user_func_array()');
619
-				$call_arg = "$this->methodname";	// straight assignment changes $this->methodname to lower case after call_user_func_array()
620
-			} elseif ($delim == '..') {
621
-				$this->debug('in invoke_method, calling class method using call_user_func_array()');
622
-				$call_arg = array ($class, $method);
623
-			} else {
624
-				$this->debug('in invoke_method, calling instance method using call_user_func_array()');
625
-				$instance = new $class ();
626
-				$call_arg = array(&$instance, $method);
627
-			}
628
-			if (is_array($this->methodparams)) {
629
-				$this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams));
630
-			} else {
631
-				$this->methodreturn = call_user_func_array($call_arg, array());
632
-			}
633
-		}
583
+        // if there are parameters to pass
584
+        $this->debug('in invoke_method, params:');
585
+        $this->appendDebug($this->varDump($this->methodparams));
586
+        $this->debug("in invoke_method, calling '$this->methodname'");
587
+        if (!function_exists('call_user_func_array')) {
588
+            if ($class == '') {
589
+                $this->debug('in invoke_method, calling function using eval()');
590
+                $funcCall = "\$this->methodreturn = $this->methodname(";
591
+            } else {
592
+                if ($delim == '..') {
593
+                    $this->debug('in invoke_method, calling class method using eval()');
594
+                    $funcCall = "\$this->methodreturn = ".$class."::".$method."(";
595
+                } else {
596
+                    $this->debug('in invoke_method, calling instance method using eval()');
597
+                    // generate unique instance name
598
+                    $instname = "\$inst_".time();
599
+                    $funcCall = $instname." = new ".$class."(); ";
600
+                    $funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
601
+                }
602
+            }
603
+            if ($this->methodparams) {
604
+                foreach ($this->methodparams as $param) {
605
+                    if (is_array($param) || is_object($param)) {
606
+                        $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
607
+                        return;
608
+                    }
609
+                    $funcCall .= "\"$param\",";
610
+                }
611
+                $funcCall = substr($funcCall, 0, -1);
612
+            }
613
+            $funcCall .= ');';
614
+            $this->debug('in invoke_method, function call: '.$funcCall);
615
+            @eval($funcCall);
616
+        } else {
617
+            if ($class == '') {
618
+                $this->debug('in invoke_method, calling function using call_user_func_array()');
619
+                $call_arg = "$this->methodname";	// straight assignment changes $this->methodname to lower case after call_user_func_array()
620
+            } elseif ($delim == '..') {
621
+                $this->debug('in invoke_method, calling class method using call_user_func_array()');
622
+                $call_arg = array ($class, $method);
623
+            } else {
624
+                $this->debug('in invoke_method, calling instance method using call_user_func_array()');
625
+                $instance = new $class ();
626
+                $call_arg = array(&$instance, $method);
627
+            }
628
+            if (is_array($this->methodparams)) {
629
+                $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams));
630
+            } else {
631
+                $this->methodreturn = call_user_func_array($call_arg, array());
632
+            }
633
+        }
634 634
         $this->debug('in invoke_method, methodreturn:');
635 635
         $this->appendDebug($this->varDump($this->methodreturn));
636
-		$this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn));
637
-	}
636
+        $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn));
637
+    }
638 638
 
639
-	/**
640
-	* serializes the return value from a PHP function into a full SOAP Envelope
641
-	*
642
-	* The following fields are set by this function (when successful)
643
-	*
644
-	* responseSOAP
645
-	*
646
-	* This sets the fault field on error
647
-	*
648
-	* @access   private
649
-	*/
650
-	function serialize_return() {
651
-		$this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
652
-		// if fault
653
-		if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
654
-			$this->debug('got a fault object from method');
655
-			$this->fault = $this->methodreturn;
656
-			return;
657
-		} elseif ($this->methodreturnisliteralxml) {
658
-			$return_val = $this->methodreturn;
659
-		// returned value(s)
660
-		} else {
661
-			$this->debug('got a(n) '.gettype($this->methodreturn).' from method');
662
-			$this->debug('serializing return value');
663
-			if($this->wsdl){
664
-				$opParams = "";
665
-				if (sizeof($this->opData['output']['parts']) > 1) {
666
-					$this->debug('more than one output part, so use the method return unchanged');
667
-			    	$opParams = $this->methodreturn;
668
-			    } elseif (sizeof($this->opData['output']['parts']) == 1) {
669
-					$this->debug('exactly one output part, so wrap the method return in a simple array');
670
-					// TODO: verify that it is not already wrapped!
671
-			    	//foreach ($this->opData['output']['parts'] as $name => $type) {
672
-					//	$this->debug('wrap in element named ' . $name);
673
-			    	//}
674
-			    	$opParams = array($this->methodreturn);
675
-			    }
676
-			    $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
677
-			    $this->appendDebug($this->wsdl->getDebug());
678
-			    $this->wsdl->clearDebug();
679
-				if($errstr = $this->wsdl->getError()){
680
-					$this->debug('got wsdl error: '.$errstr);
681
-					$this->fault('SOAP-ENV:Server', 'unable to serialize result');
682
-					return;
683
-				}
684
-			} else {
685
-				if (isset($this->methodreturn)) {
686
-					$return_val = $this->serialize_val($this->methodreturn, 'return');
687
-				} else {
688
-					$return_val = '';
689
-					$this->debug('in absence of WSDL, assume void return for backward compatibility');
690
-				}
691
-			}
692
-		}
693
-		$this->debug('return value:');
694
-		$this->appendDebug($this->varDump($return_val));
639
+    /**
640
+     * serializes the return value from a PHP function into a full SOAP Envelope
641
+     *
642
+     * The following fields are set by this function (when successful)
643
+     *
644
+     * responseSOAP
645
+     *
646
+     * This sets the fault field on error
647
+     *
648
+     * @access   private
649
+     */
650
+    function serialize_return() {
651
+        $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
652
+        // if fault
653
+        if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
654
+            $this->debug('got a fault object from method');
655
+            $this->fault = $this->methodreturn;
656
+            return;
657
+        } elseif ($this->methodreturnisliteralxml) {
658
+            $return_val = $this->methodreturn;
659
+        // returned value(s)
660
+        } else {
661
+            $this->debug('got a(n) '.gettype($this->methodreturn).' from method');
662
+            $this->debug('serializing return value');
663
+            if($this->wsdl){
664
+                $opParams = "";
665
+                if (sizeof($this->opData['output']['parts']) > 1) {
666
+                    $this->debug('more than one output part, so use the method return unchanged');
667
+                    $opParams = $this->methodreturn;
668
+                } elseif (sizeof($this->opData['output']['parts']) == 1) {
669
+                    $this->debug('exactly one output part, so wrap the method return in a simple array');
670
+                    // TODO: verify that it is not already wrapped!
671
+                    //foreach ($this->opData['output']['parts'] as $name => $type) {
672
+                    //	$this->debug('wrap in element named ' . $name);
673
+                    //}
674
+                    $opParams = array($this->methodreturn);
675
+                }
676
+                $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
677
+                $this->appendDebug($this->wsdl->getDebug());
678
+                $this->wsdl->clearDebug();
679
+                if($errstr = $this->wsdl->getError()){
680
+                    $this->debug('got wsdl error: '.$errstr);
681
+                    $this->fault('SOAP-ENV:Server', 'unable to serialize result');
682
+                    return;
683
+                }
684
+            } else {
685
+                if (isset($this->methodreturn)) {
686
+                    $return_val = $this->serialize_val($this->methodreturn, 'return');
687
+                } else {
688
+                    $return_val = '';
689
+                    $this->debug('in absence of WSDL, assume void return for backward compatibility');
690
+                }
691
+            }
692
+        }
693
+        $this->debug('return value:');
694
+        $this->appendDebug($this->varDump($return_val));
695 695
 
696
-		$this->debug('serializing response');
697
-		if ($this->wsdl) {
698
-			$this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
699
-			if ($this->opData['style'] == 'rpc') {
700
-				$this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
701
-				if ($this->opData['output']['use'] == 'literal') {
702
-					// http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
703
-					if ($this->methodURI) {
704
-						$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
705
-					} else {
706
-						$payload = '<'.$this->methodname.'Response>'.$return_val.'</'.$this->methodname.'Response>';
707
-					}
708
-				} else {
709
-					if ($this->methodURI) {
710
-						$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
711
-					} else {
712
-						$payload = '<'.$this->methodname.'Response>'.$return_val.'</'.$this->methodname.'Response>';
713
-					}
714
-				}
715
-			} else {
716
-				$this->debug('style is not rpc for serialization: assume document');
717
-				$payload = $return_val;
718
-			}
719
-		} else {
720
-			$this->debug('do not have WSDL for serialization: assume rpc/encoded');
721
-			$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
722
-		}
723
-		$this->result = 'successful';
724
-		if($this->wsdl){
725
-			//if($this->debug_flag){
726
-            	$this->appendDebug($this->wsdl->getDebug());
696
+        $this->debug('serializing response');
697
+        if ($this->wsdl) {
698
+            $this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
699
+            if ($this->opData['style'] == 'rpc') {
700
+                $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
701
+                if ($this->opData['output']['use'] == 'literal') {
702
+                    // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
703
+                    if ($this->methodURI) {
704
+                        $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
705
+                    } else {
706
+                        $payload = '<'.$this->methodname.'Response>'.$return_val.'</'.$this->methodname.'Response>';
707
+                    }
708
+                } else {
709
+                    if ($this->methodURI) {
710
+                        $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
711
+                    } else {
712
+                        $payload = '<'.$this->methodname.'Response>'.$return_val.'</'.$this->methodname.'Response>';
713
+                    }
714
+                }
715
+            } else {
716
+                $this->debug('style is not rpc for serialization: assume document');
717
+                $payload = $return_val;
718
+            }
719
+        } else {
720
+            $this->debug('do not have WSDL for serialization: assume rpc/encoded');
721
+            $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
722
+        }
723
+        $this->result = 'successful';
724
+        if($this->wsdl){
725
+            //if($this->debug_flag){
726
+                $this->appendDebug($this->wsdl->getDebug());
727 727
             //	}
728
-			if (isset($this->opData['output']['encodingStyle'])) {
729
-				$encodingStyle = $this->opData['output']['encodingStyle'];
730
-			} else {
731
-				$encodingStyle = '';
732
-			}
733
-			// Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
734
-			$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle);
735
-		} else {
736
-			$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
737
-		}
738
-		$this->debug("Leaving serialize_return");
739
-	}
728
+            if (isset($this->opData['output']['encodingStyle'])) {
729
+                $encodingStyle = $this->opData['output']['encodingStyle'];
730
+            } else {
731
+                $encodingStyle = '';
732
+            }
733
+            // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
734
+            $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle);
735
+        } else {
736
+            $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
737
+        }
738
+        $this->debug("Leaving serialize_return");
739
+    }
740 740
 
741
-	/**
742
-	* sends an HTTP response
743
-	*
744
-	* The following fields are set by this function (when successful)
745
-	*
746
-	* outgoing_headers
747
-	* response
748
-	*
749
-	* @access   private
750
-	*/
751
-	function send_response() {
752
-		$this->debug('Enter send_response');
753
-		if ($this->fault) {
754
-			$payload = $this->fault->serialize();
755
-			$this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
756
-			$this->outgoing_headers[] = "Status: 500 Internal Server Error";
757
-		} else {
758
-			$payload = $this->responseSOAP;
759
-			// Some combinations of PHP+Web server allow the Status
760
-			// to come through as a header.  Since OK is the default
761
-			// just do nothing.
762
-			// $this->outgoing_headers[] = "HTTP/1.0 200 OK";
763
-			// $this->outgoing_headers[] = "Status: 200 OK";
764
-		}
741
+    /**
742
+     * sends an HTTP response
743
+     *
744
+     * The following fields are set by this function (when successful)
745
+     *
746
+     * outgoing_headers
747
+     * response
748
+     *
749
+     * @access   private
750
+     */
751
+    function send_response() {
752
+        $this->debug('Enter send_response');
753
+        if ($this->fault) {
754
+            $payload = $this->fault->serialize();
755
+            $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
756
+            $this->outgoing_headers[] = "Status: 500 Internal Server Error";
757
+        } else {
758
+            $payload = $this->responseSOAP;
759
+            // Some combinations of PHP+Web server allow the Status
760
+            // to come through as a header.  Since OK is the default
761
+            // just do nothing.
762
+            // $this->outgoing_headers[] = "HTTP/1.0 200 OK";
763
+            // $this->outgoing_headers[] = "Status: 200 OK";
764
+        }
765 765
         // add debug data if in debug mode
766
-		if(isset($this->debug_flag) && $this->debug_flag){
767
-        	$payload .= $this->getDebugAsXMLComment();
766
+        if(isset($this->debug_flag) && $this->debug_flag){
767
+            $payload .= $this->getDebugAsXMLComment();
768
+        }
769
+        $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
770
+        preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
771
+        $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
772
+        // Let the Web server decide about this
773
+        //$this->outgoing_headers[] = "Connection: Close\r\n";
774
+        $payload = $this->getHTTPBody($payload);
775
+        $type = $this->getHTTPContentType();
776
+        $charset = $this->getHTTPContentTypeCharset();
777
+        $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
778
+        //begin code to compress payload - by John
779
+        // NOTE: there is no way to know whether the Web server will also compress
780
+        // this data.
781
+        if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
782
+            if (strstr($this->headers['accept-encoding'], 'gzip')) {
783
+                if (function_exists('gzencode')) {
784
+                    if (isset($this->debug_flag) && $this->debug_flag) {
785
+                        $payload .= "<!-- Content being gzipped -->";
786
+                    }
787
+                    $this->outgoing_headers[] = "Content-Encoding: gzip";
788
+                    $payload = gzencode($payload);
789
+                } else {
790
+                    if (isset($this->debug_flag) && $this->debug_flag) {
791
+                        $payload .= "<!-- Content will not be gzipped: no gzencode -->";
792
+                    }
793
+                }
794
+            } elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
795
+                // Note: MSIE requires gzdeflate output (no Zlib header and checksum),
796
+                // instead of gzcompress output,
797
+                // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5)
798
+                if (function_exists('gzdeflate')) {
799
+                    if (isset($this->debug_flag) && $this->debug_flag) {
800
+                        $payload .= "<!-- Content being deflated -->";
801
+                    }
802
+                    $this->outgoing_headers[] = "Content-Encoding: deflate";
803
+                    $payload = gzdeflate($payload);
804
+                } else {
805
+                    if (isset($this->debug_flag) && $this->debug_flag) {
806
+                        $payload .= "<!-- Content will not be deflated: no gzcompress -->";
807
+                    }
808
+                }
809
+            }
768 810
         }
769
-		$this->outgoing_headers[] = "Server: $this->title Server v$this->version";
770
-		preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
771
-		$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
772
-		// Let the Web server decide about this
773
-		//$this->outgoing_headers[] = "Connection: Close\r\n";
774
-		$payload = $this->getHTTPBody($payload);
775
-		$type = $this->getHTTPContentType();
776
-		$charset = $this->getHTTPContentTypeCharset();
777
-		$this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
778
-		//begin code to compress payload - by John
779
-		// NOTE: there is no way to know whether the Web server will also compress
780
-		// this data.
781
-		if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
782
-			if (strstr($this->headers['accept-encoding'], 'gzip')) {
783
-				if (function_exists('gzencode')) {
784
-					if (isset($this->debug_flag) && $this->debug_flag) {
785
-						$payload .= "<!-- Content being gzipped -->";
786
-					}
787
-					$this->outgoing_headers[] = "Content-Encoding: gzip";
788
-					$payload = gzencode($payload);
789
-				} else {
790
-					if (isset($this->debug_flag) && $this->debug_flag) {
791
-						$payload .= "<!-- Content will not be gzipped: no gzencode -->";
792
-					}
793
-				}
794
-			} elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
795
-				// Note: MSIE requires gzdeflate output (no Zlib header and checksum),
796
-				// instead of gzcompress output,
797
-				// which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5)
798
-				if (function_exists('gzdeflate')) {
799
-					if (isset($this->debug_flag) && $this->debug_flag) {
800
-						$payload .= "<!-- Content being deflated -->";
801
-					}
802
-					$this->outgoing_headers[] = "Content-Encoding: deflate";
803
-					$payload = gzdeflate($payload);
804
-				} else {
805
-					if (isset($this->debug_flag) && $this->debug_flag) {
806
-						$payload .= "<!-- Content will not be deflated: no gzcompress -->";
807
-					}
808
-				}
809
-			}
810
-		}
811
-		//end code
812
-		$this->outgoing_headers[] = "Content-Length: ".strlen($payload);
813
-		reset($this->outgoing_headers);
814
-		foreach($this->outgoing_headers as $hdr){
815
-			header($hdr, false);
816
-		}
817
-		print $payload;
818
-		$this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
819
-	}
811
+        //end code
812
+        $this->outgoing_headers[] = "Content-Length: ".strlen($payload);
813
+        reset($this->outgoing_headers);
814
+        foreach($this->outgoing_headers as $hdr){
815
+            header($hdr, false);
816
+        }
817
+        print $payload;
818
+        $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
819
+    }
820 820
 
821
-	/**
822
-	* takes the value that was created by parsing the request
823
-	* and compares to the method's signature, if available.
824
-	*
825
-	* @param	string	$operation	The operation to be invoked
826
-	* @param	array	$request	The array of parameter values
827
-	* @return	boolean	Whether the operation was found
828
-	* @access   private
829
-	*/
830
-	function verify_method($operation,$request){
831
-		if(isset($this->wsdl) && is_object($this->wsdl)){
832
-			if($this->wsdl->getOperationData($operation)){
833
-				return true;
834
-			}
835
-	    } elseif(isset($this->operations[$operation])){
836
-			return true;
837
-		}
838
-		return false;
839
-	}
821
+    /**
822
+     * takes the value that was created by parsing the request
823
+     * and compares to the method's signature, if available.
824
+     *
825
+     * @param	string	$operation	The operation to be invoked
826
+     * @param	array	$request	The array of parameter values
827
+     * @return	boolean	Whether the operation was found
828
+     * @access   private
829
+     */
830
+    function verify_method($operation,$request){
831
+        if(isset($this->wsdl) && is_object($this->wsdl)){
832
+            if($this->wsdl->getOperationData($operation)){
833
+                return true;
834
+            }
835
+        } elseif(isset($this->operations[$operation])){
836
+            return true;
837
+        }
838
+        return false;
839
+    }
840 840
 
841
-	/**
842
-	* processes SOAP message received from client
843
-	*
844
-	* @param	array	$headers	The HTTP headers
845
-	* @param	string	$data		unprocessed request data from client
846
-	* @return	mixed	value of the message, decoded into a PHP type
847
-	* @access   private
848
-	*/
841
+    /**
842
+     * processes SOAP message received from client
843
+     *
844
+     * @param	array	$headers	The HTTP headers
845
+     * @param	string	$data		unprocessed request data from client
846
+     * @return	mixed	value of the message, decoded into a PHP type
847
+     * @access   private
848
+     */
849 849
     function parseRequest($headers, $data) {
850
-		$this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:');
851
-		$this->appendDebug($this->varDump($headers));
852
-    	if (!isset($headers['content-type'])) {
853
-			$this->setError('Request not of type text/xml (no content-type header)');
854
-			return false;
855
-    	}
856
-		if (!strstr($headers['content-type'], 'text/xml')) {
857
-			$this->setError('Request not of type text/xml');
858
-			return false;
859
-		}
860
-		if (strpos($headers['content-type'], '=')) {
861
-			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
862
-			$this->debug('Got response encoding: ' . $enc);
863
-			if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
864
-				$this->xml_encoding = strtoupper($enc);
865
-			} else {
866
-				$this->xml_encoding = 'US-ASCII';
867
-			}
868
-		} else {
869
-			// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
870
-			$this->xml_encoding = 'ISO-8859-1';
871
-		}
872
-		$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
873
-		// parse response, get soap parser obj
874
-		$parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
850
+        $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:');
851
+        $this->appendDebug($this->varDump($headers));
852
+        if (!isset($headers['content-type'])) {
853
+            $this->setError('Request not of type text/xml (no content-type header)');
854
+            return false;
855
+        }
856
+        if (!strstr($headers['content-type'], 'text/xml')) {
857
+            $this->setError('Request not of type text/xml');
858
+            return false;
859
+        }
860
+        if (strpos($headers['content-type'], '=')) {
861
+            $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
862
+            $this->debug('Got response encoding: ' . $enc);
863
+            if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
864
+                $this->xml_encoding = strtoupper($enc);
865
+            } else {
866
+                $this->xml_encoding = 'US-ASCII';
867
+            }
868
+        } else {
869
+            // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
870
+            $this->xml_encoding = 'ISO-8859-1';
871
+        }
872
+        $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
873
+        // parse response, get soap parser obj
874
+        $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
875 875
 
876
-		// parser debug
877
-		$this->debug("parser debug: \n".$parser->getDebug());
878
-		// if fault occurred during message parsing
879
-		if($err = $parser->getError()){
880
-			$this->result = 'fault: error in msg parsing: '.$err;
881
-			$this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err);
882
-		// else successfully parsed request into soapval object
883
-		} else {
884
-			// get/set methodname
885
-			$this->methodURI = $parser->root_struct_namespace;
886
-			$this->methodname = $parser->root_struct_name;
887
-			$this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
888
-			$this->debug('calling parser->get_soapbody()');
889
-			$this->methodparams = $parser->get_soapbody();
890
-			// get SOAP headers
891
-			$this->requestHeaders = $parser->getHeaders();
892
-			// get SOAP Header
893
-			$this->requestHeader = $parser->get_soapheader();
876
+        // parser debug
877
+        $this->debug("parser debug: \n".$parser->getDebug());
878
+        // if fault occurred during message parsing
879
+        if($err = $parser->getError()){
880
+            $this->result = 'fault: error in msg parsing: '.$err;
881
+            $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err);
882
+        // else successfully parsed request into soapval object
883
+        } else {
884
+            // get/set methodname
885
+            $this->methodURI = $parser->root_struct_namespace;
886
+            $this->methodname = $parser->root_struct_name;
887
+            $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
888
+            $this->debug('calling parser->get_soapbody()');
889
+            $this->methodparams = $parser->get_soapbody();
890
+            // get SOAP headers
891
+            $this->requestHeaders = $parser->getHeaders();
892
+            // get SOAP Header
893
+            $this->requestHeader = $parser->get_soapheader();
894 894
             // add document for doclit support
895 895
             $this->document = $parser->document;
896
-		}
897
-	 }
896
+        }
897
+        }
898 898
 
899
-	/**
900
-	* gets the HTTP body for the current response.
901
-	*
902
-	* @param string $soapmsg The SOAP payload
903
-	* @return string The HTTP body, which includes the SOAP payload
904
-	* @access private
905
-	*/
906
-	function getHTTPBody($soapmsg) {
907
-		return $soapmsg;
908
-	}
899
+    /**
900
+     * gets the HTTP body for the current response.
901
+     *
902
+     * @param string $soapmsg The SOAP payload
903
+     * @return string The HTTP body, which includes the SOAP payload
904
+     * @access private
905
+     */
906
+    function getHTTPBody($soapmsg) {
907
+        return $soapmsg;
908
+    }
909 909
 
910
-	/**
911
-	* gets the HTTP content type for the current response.
912
-	*
913
-	* Note: getHTTPBody must be called before this.
914
-	*
915
-	* @return string the HTTP content type for the current response.
916
-	* @access private
917
-	*/
918
-	function getHTTPContentType() {
919
-		return 'text/xml';
920
-	}
910
+    /**
911
+     * gets the HTTP content type for the current response.
912
+     *
913
+     * Note: getHTTPBody must be called before this.
914
+     *
915
+     * @return string the HTTP content type for the current response.
916
+     * @access private
917
+     */
918
+    function getHTTPContentType() {
919
+        return 'text/xml';
920
+    }
921 921
 
922
-	/**
923
-	* gets the HTTP content type charset for the current response.
924
-	* returns false for non-text content types.
925
-	*
926
-	* Note: getHTTPBody must be called before this.
927
-	*
928
-	* @return string the HTTP content type charset for the current response.
929
-	* @access private
930
-	*/
931
-	function getHTTPContentTypeCharset() {
932
-		return $this->soap_defencoding;
933
-	}
922
+    /**
923
+     * gets the HTTP content type charset for the current response.
924
+     * returns false for non-text content types.
925
+     *
926
+     * Note: getHTTPBody must be called before this.
927
+     *
928
+     * @return string the HTTP content type charset for the current response.
929
+     * @access private
930
+     */
931
+    function getHTTPContentTypeCharset() {
932
+        return $this->soap_defencoding;
933
+    }
934 934
 
935
-	/**
936
-	* add a method to the dispatch map (this has been replaced by the register method)
937
-	*
938
-	* @param    string $methodname
939
-	* @param    string $in array of input values
940
-	* @param    string $out array of output values
941
-	* @access   public
942
-	* @deprecated
943
-	*/
944
-	function add_to_map($methodname,$in,$out){
945
-			$this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
946
-	}
935
+    /**
936
+     * add a method to the dispatch map (this has been replaced by the register method)
937
+     *
938
+     * @param    string $methodname
939
+     * @param    string $in array of input values
940
+     * @param    string $out array of output values
941
+     * @access   public
942
+     * @deprecated
943
+     */
944
+    function add_to_map($methodname,$in,$out){
945
+            $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
946
+    }
947 947
 
948
-	/**
949
-	* register a service function with the server
950
-	*
951
-	* @param    string $name the name of the PHP function, class.method or class..method
952
-	* @param    array $in assoc array of input values: key = param name, value = param type
953
-	* @param    array $out assoc array of output values: key = param name, value = param type
954
-	* @param	mixed $namespace the element namespace for the method or false
955
-	* @param	mixed $soapaction the soapaction for the method or false
956
-	* @param	mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
957
-	* @param	mixed $use optional (encoded|literal) or false
958
-	* @param	string $documentation optional Description to include in WSDL
959
-	* @param	string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
960
-	* @access   public
961
-	*/
962
-	function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){
963
-		global $HTTP_SERVER_VARS;
948
+    /**
949
+     * register a service function with the server
950
+     *
951
+     * @param    string $name the name of the PHP function, class.method or class..method
952
+     * @param    array $in assoc array of input values: key = param name, value = param type
953
+     * @param    array $out assoc array of output values: key = param name, value = param type
954
+     * @param	mixed $namespace the element namespace for the method or false
955
+     * @param	mixed $soapaction the soapaction for the method or false
956
+     * @param	mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
957
+     * @param	mixed $use optional (encoded|literal) or false
958
+     * @param	string $documentation optional Description to include in WSDL
959
+     * @param	string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
960
+     * @access   public
961
+     */
962
+    function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){
963
+        global $HTTP_SERVER_VARS;
964 964
 
965
-		if($this->externalWSDLURL){
966
-			die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
967
-		}
968
-		if (! $name) {
969
-			die('You must specify a name when you register an operation');
970
-		}
971
-		if (!is_array($in)) {
972
-			die('You must provide an array for operation inputs');
973
-		}
974
-		if (!is_array($out)) {
975
-			die('You must provide an array for operation outputs');
976
-		}
977
-		if(false == $namespace) {
978
-		}
979
-		if(false == $soapaction) {
980
-			if (isset($_SERVER)) {
981
-				$SERVER_NAME = $_SERVER['SERVER_NAME'];
982
-				$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
983
-				$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
984
-			} elseif (isset($HTTP_SERVER_VARS)) {
985
-				$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
986
-				$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
987
-				$HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
988
-			} else {
989
-				$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
990
-			}
991
-        	if ($HTTPS == '1' || $HTTPS == 'on') {
992
-        		$SCHEME = 'https';
993
-        	} else {
994
-        		$SCHEME = 'http';
995
-        	}
996
-			$soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name";
997
-		}
998
-		if(false == $style) {
999
-			$style = "rpc";
1000
-		}
1001
-		if(false == $use) {
1002
-			$use = "encoded";
1003
-		}
1004
-		if ($use == 'encoded' && $encodingStyle == '') {
1005
-			$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1006
-		}
965
+        if($this->externalWSDLURL){
966
+            die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
967
+        }
968
+        if (! $name) {
969
+            die('You must specify a name when you register an operation');
970
+        }
971
+        if (!is_array($in)) {
972
+            die('You must provide an array for operation inputs');
973
+        }
974
+        if (!is_array($out)) {
975
+            die('You must provide an array for operation outputs');
976
+        }
977
+        if(false == $namespace) {
978
+        }
979
+        if(false == $soapaction) {
980
+            if (isset($_SERVER)) {
981
+                $SERVER_NAME = $_SERVER['SERVER_NAME'];
982
+                $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
983
+                $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
984
+            } elseif (isset($HTTP_SERVER_VARS)) {
985
+                $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
986
+                $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
987
+                $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
988
+            } else {
989
+                $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
990
+            }
991
+            if ($HTTPS == '1' || $HTTPS == 'on') {
992
+                $SCHEME = 'https';
993
+            } else {
994
+                $SCHEME = 'http';
995
+            }
996
+            $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name";
997
+        }
998
+        if(false == $style) {
999
+            $style = "rpc";
1000
+        }
1001
+        if(false == $use) {
1002
+            $use = "encoded";
1003
+        }
1004
+        if ($use == 'encoded' && $encodingStyle == '') {
1005
+            $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1006
+        }
1007 1007
 
1008
-		$this->operations[$name] = array(
1009
-	    'name' => $name,
1010
-	    'in' => $in,
1011
-	    'out' => $out,
1012
-	    'namespace' => $namespace,
1013
-	    'soapaction' => $soapaction,
1014
-	    'style' => $style);
1008
+        $this->operations[$name] = array(
1009
+        'name' => $name,
1010
+        'in' => $in,
1011
+        'out' => $out,
1012
+        'namespace' => $namespace,
1013
+        'soapaction' => $soapaction,
1014
+        'style' => $style);
1015 1015
         if($this->wsdl){
1016
-        	$this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle);
1017
-	    }
1018
-		return true;
1019
-	}
1016
+            $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle);
1017
+        }
1018
+        return true;
1019
+    }
1020 1020
 
1021
-	/**
1022
-	* Specify a fault to be returned to the client.
1023
-	* This also acts as a flag to the server that a fault has occured.
1024
-	*
1025
-	* @param	string $faultcode
1026
-	* @param	string $faultstring
1027
-	* @param	string $faultactor
1028
-	* @param	string $faultdetail
1029
-	* @access   public
1030
-	*/
1031
-	function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){
1032
-		if ($faultdetail == '' && $this->debug_flag) {
1033
-			$faultdetail = $this->getDebug();
1034
-		}
1035
-		$this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
1036
-		$this->fault->soap_defencoding = $this->soap_defencoding;
1037
-	}
1021
+    /**
1022
+     * Specify a fault to be returned to the client.
1023
+     * This also acts as a flag to the server that a fault has occured.
1024
+     *
1025
+     * @param	string $faultcode
1026
+     * @param	string $faultstring
1027
+     * @param	string $faultactor
1028
+     * @param	string $faultdetail
1029
+     * @access   public
1030
+     */
1031
+    function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){
1032
+        if ($faultdetail == '' && $this->debug_flag) {
1033
+            $faultdetail = $this->getDebug();
1034
+        }
1035
+        $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
1036
+        $this->fault->soap_defencoding = $this->soap_defencoding;
1037
+    }
1038 1038
 
1039 1039
     /**
1040
-    * Sets up wsdl object.
1041
-    * Acts as a flag to enable internal WSDL generation
1042
-    *
1043
-    * @param string $serviceName, name of the service
1044
-    * @param mixed $namespace optional 'tns' service namespace or false
1045
-    * @param mixed $endpoint optional URL of service endpoint or false
1046
-    * @param string $style optional (rpc|document) WSDL style (also specified by operation)
1047
-    * @param string $transport optional SOAP transport
1048
-    * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false
1049
-    */
1040
+     * Sets up wsdl object.
1041
+     * Acts as a flag to enable internal WSDL generation
1042
+     *
1043
+     * @param string $serviceName, name of the service
1044
+     * @param mixed $namespace optional 'tns' service namespace or false
1045
+     * @param mixed $endpoint optional URL of service endpoint or false
1046
+     * @param string $style optional (rpc|document) WSDL style (also specified by operation)
1047
+     * @param string $transport optional SOAP transport
1048
+     * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false
1049
+     */
1050 1050
     function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
1051 1051
     {
1052
-    	global $HTTP_SERVER_VARS;
1052
+        global $HTTP_SERVER_VARS;
1053 1053
 
1054
-		if (isset($_SERVER)) {
1055
-			$SERVER_NAME = $_SERVER['SERVER_NAME'];
1056
-			$SERVER_PORT = $_SERVER['SERVER_PORT'];
1057
-			$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
1058
-			$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
1059
-		} elseif (isset($HTTP_SERVER_VARS)) {
1060
-			$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
1061
-			$SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
1062
-			$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
1063
-			$HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
1064
-		} else {
1065
-			$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
1066
-		}
1067
-		// If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI)
1068
-		$colon = strpos($SERVER_NAME,":");
1069
-		if ($colon) {
1070
-		    $SERVER_NAME = substr($SERVER_NAME, 0, $colon);
1071
-		}
1072
-		if ($SERVER_PORT == 80) {
1073
-			$SERVER_PORT = '';
1074
-		} else {
1075
-			$SERVER_PORT = ':' . $SERVER_PORT;
1076
-		}
1054
+        if (isset($_SERVER)) {
1055
+            $SERVER_NAME = $_SERVER['SERVER_NAME'];
1056
+            $SERVER_PORT = $_SERVER['SERVER_PORT'];
1057
+            $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
1058
+            $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
1059
+        } elseif (isset($HTTP_SERVER_VARS)) {
1060
+            $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
1061
+            $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
1062
+            $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
1063
+            $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
1064
+        } else {
1065
+            $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
1066
+        }
1067
+        // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI)
1068
+        $colon = strpos($SERVER_NAME,":");
1069
+        if ($colon) {
1070
+            $SERVER_NAME = substr($SERVER_NAME, 0, $colon);
1071
+        }
1072
+        if ($SERVER_PORT == 80) {
1073
+            $SERVER_PORT = '';
1074
+        } else {
1075
+            $SERVER_PORT = ':' . $SERVER_PORT;
1076
+        }
1077 1077
         if(false == $namespace) {
1078 1078
             $namespace = "http://$SERVER_NAME/soap/$serviceName";
1079 1079
         }
1080 1080
 
1081 1081
         if(false == $endpoint) {
1082
-        	if ($HTTPS == '1' || $HTTPS == 'on') {
1083
-        		$SCHEME = 'https';
1084
-        	} else {
1085
-        		$SCHEME = 'http';
1086
-        	}
1082
+            if ($HTTPS == '1' || $HTTPS == 'on') {
1083
+                $SCHEME = 'https';
1084
+            } else {
1085
+                $SCHEME = 'http';
1086
+            }
1087 1087
             $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
1088 1088
         }
1089 1089
 
@@ -1091,29 +1091,29 @@  discard block
 block discarded – undo
1091 1091
             $schemaTargetNamespace = $namespace;
1092 1092
         }
1093 1093
 
1094
-		$this->wsdl = new wsdl;
1095
-		$this->wsdl->serviceName = $serviceName;
1094
+        $this->wsdl = new wsdl;
1095
+        $this->wsdl->serviceName = $serviceName;
1096 1096
         $this->wsdl->endpoint = $endpoint;
1097
-		$this->wsdl->namespaces['tns'] = $namespace;
1098
-		$this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
1099
-		$this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
1100
-		if ($schemaTargetNamespace != $namespace) {
1101
-			$this->wsdl->namespaces['types'] = $schemaTargetNamespace;
1102
-		}
1097
+        $this->wsdl->namespaces['tns'] = $namespace;
1098
+        $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
1099
+        $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
1100
+        if ($schemaTargetNamespace != $namespace) {
1101
+            $this->wsdl->namespaces['types'] = $schemaTargetNamespace;
1102
+        }
1103 1103
         $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces);
1104 1104
         if ($style == 'document') {
1105
-	        $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified';
1105
+            $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified';
1106 1106
         }
1107 1107
         $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
1108 1108
         $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true);
1109 1109
         $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true);
1110 1110
         $this->wsdl->bindings[$serviceName.'Binding'] = array(
1111
-        	'name'=>$serviceName.'Binding',
1111
+            'name'=>$serviceName.'Binding',
1112 1112
             'style'=>$style,
1113 1113
             'transport'=>$transport,
1114 1114
             'portType'=>$serviceName.'PortType');
1115 1115
         $this->wsdl->ports[$serviceName.'Port'] = array(
1116
-        	'binding'=>$serviceName.'Binding',
1116
+            'binding'=>$serviceName.'Binding',
1117 1117
             'location'=>$endpoint,
1118 1118
             'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/');
1119 1119
     }
Please login to merge, or discard this patch.