Lines Matching refs:this

62 		$this->xml = $xml;
63 $this->xml_encoding = $encoding;
64 $this->method = $method;
65 $this->decode_utf8 = $decode_utf8;
77 $this->debug($err);
79 $this->setError($err);
84 $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
87 $this->debug('No encoding specified in XML declaration');
90 $this->debug('No XML declaration');
92 $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
94 $this->parser = xml_parser_create($this->xml_encoding);
97 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
98 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
100 xml_set_object($this->parser, $this);
102 xml_set_element_handler($this->parser, 'start_element','end_element');
103 xml_set_character_data_handler($this->parser,'character_data');
106 if(!xml_parse($this->parser,$xml,true)){
109 xml_get_current_line_number($this->parser),
110 xml_error_string(xml_get_error_code($this->parser)));
111 $this->debug($err);
112 $this->debug("XML payload:\n" . $xml);
113 $this->setError($err);
115 …$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root…
117 $this->soapresponse = $this->message[$this->root_struct]['result'];
119 if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
120 $this->soapheader = $this->message[$this->root_header]['result'];
123 if(sizeof($this->multirefs) > 0){
124 foreach($this->multirefs as $id => $hrefs){
125 $this->debug('resolving multirefs for id: '.$id);
126 $idVal = $this->buildVal($this->ids[$id]);
131 $this->debug('resolving href at pos '.$refPos);
132 $this->multirefs[$id][$refPos] = $idVal;
137 xml_parser_free($this->parser);
139 $this->debug('xml was empty, didn\'t parse!');
140 $this->setError('xml was empty, didn\'t parse!');
155 $pos = $this->position++;
157 $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
160 $this->message[$pos]['depth'] = $this->depth++;
164 $this->message[$this->parent]['children'] .= '|'.$pos;
167 $this->message[$pos]['parent'] = $this->parent;
169 $this->parent = $pos;
171 $this->depth_array[$this->depth] = $pos;
181 $this->status = 'envelope';
182 } elseif($name == 'Header' && $this->status = 'envelope'){
183 $this->root_header = $pos;
184 $this->status = 'header';
185 } elseif($name == 'Body' && $this->status = 'envelope'){
186 $this->status = 'body';
187 $this->body_position = $pos;
189 } elseif($this->status == 'body' && $pos == ($this->body_position+1)){
190 $this->status = 'method';
191 $this->root_struct_name = $name;
192 $this->root_struct = $pos;
193 $this->message[$pos]['type'] = 'struct';
194 $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
197 $this->message[$pos]['status'] = $this->status;
199 $this->message[$pos]['name'] = htmlspecialchars($name);
201 $this->message[$pos]['attrs'] = $attrs;
206 $key_prefix = $this->getPrefix($key);
207 $key_localpart = $this->getLocalPart($key);
211 $this->XMLSchemaVersion = $value;
212 $this->namespaces['xsd'] = $this->XMLSchemaVersion;
213 $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
215 $this->namespaces[$key_localpart] = $value;
217 if($name == $this->root_struct_name){
218 $this->methodNamespace = $value;
222 if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
225 $value_prefix = $this->getPrefix($value);
226 $value_localpart = $this->getLocalPart($value);
227 $this->message[$pos]['type'] = $value_localpart;
228 $this->message[$pos]['typePrefix'] = $value_prefix;
229 if(isset($this->namespaces[$value_prefix])){
230 $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
232 $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
237 $this->message[$pos]['type'] = 'array';
248 $this->message[$pos]['typePrefix'] = $regs[1];
249 $this->message[$pos]['arrayTypePrefix'] = $regs[1];
250 if (isset($this->namespaces[$regs[1]])) {
251 $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
253 $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
255 $this->message[$pos]['arrayType'] = $regs[2];
256 $this->message[$pos]['arraySize'] = $regs[3];
257 $this->message[$pos]['arrayCols'] = $regs[4];
261 $this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
264 $this->message[$pos]['xattrs']['!' . $key] = $value;
268 $this->default_namespace = $value;
272 $this->ids[$value] = $pos;
276 $this->status = 'method';
277 $this->root_struct_name = $name;
278 $this->root_struct = $pos;
279 $this->debug("found root struct $this->root_struct_name, pos $pos");
286 $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
287 $this->default_namespace = $this->namespaces[$prefix];
289 $this->message[$pos]['namespace'] = $this->default_namespace;
291 if($this->status == 'header'){
292 if ($this->root_header != $pos) {
293 $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
295 } elseif($this->root_struct_name != ''){
296 $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
309 $pos = $this->depth_array[$this->depth--];
320 if(isset($this->body_position) && $pos > $this->body_position){
322 if(isset($this->message[$pos]['attrs']['href'])){
324 $id = substr($this->message[$pos]['attrs']['href'],1);
326 $this->multirefs[$id][$pos] = 'placeholder';
328 $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
330 } elseif($this->message[$pos]['children'] != ''){
332 if(!isset($this->message[$pos]['result'])){
333 $this->message[$pos]['result'] = $this->buildVal($pos);
336 } elseif (isset($this->message[$pos]['xattrs'])) {
337 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
338 $this->message[$pos]['xattrs']['!'] = null;
339 } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
340 if (isset($this->message[$pos]['type'])) {
341this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->mes…
343 $parent = $this->message[$pos]['parent'];
344 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
345this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->mes…
347 $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
351 $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
355 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
356 $this->message[$pos]['xattrs']['!'] = null;
357 } elseif (isset($this->message[$pos]['type'])) {
358this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[…
360 $parent = $this->message[$pos]['parent'];
361 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
362this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[…
364 $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
382 if($this->status == 'header'){
383 if ($this->root_header != $pos) {
384 $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
386 } elseif($pos >= $this->root_struct){
387 $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
390 if($pos == $this->root_struct){
391 $this->status = 'body';
392 $this->root_struct_namespace = $this->message[$pos]['namespace'];
394 $this->status = 'envelope';
396 $this->status = 'envelope';
401 $this->parent = $this->message[$pos]['parent'];
412 $pos = $this->depth_array[$this->depth];
413 if ($this->xml_encoding=='UTF-8'){
417 if($this->decode_utf8){
421 $this->message[$pos]['cdata'] .= $data;
423 if($this->status == 'header'){
424 $this->responseHeaders .= $data;
426 $this->document .= $data;
438 return $this->soapresponse;
448 return $this->soapresponse;
458 return $this->soapheader;
468 return $this->responseHeaders;
498 $this->debug('Decode base64 value');
525 if(!isset($this->message[$pos]['type'])){
526 $this->message[$pos]['type'] = '';
528 …$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->messag…
530 if($this->message[$pos]['children'] != ''){
531 $this->debug('in buildVal, there are children');
532 $children = explode('|',$this->message[$pos]['children']);
535 if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
539 $this->debug("in buildVal, got an MD array element: $r, $c");
540 $params[$r][] = $this->message[$child_pos]['result'];
542 if($c == $this->message[$pos]['arrayCols']){
548 } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
549 $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
551 $params[] = &$this->message[$child_pos]['result'];
554 …} elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http:…
573 $params[] = &$this->message[$child_pos]['result'];
575 if (isset($params[$this->message[$child_pos]['name']])) {
577 …if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$ch…
578 … $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
580 … $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
582 $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
587 if (isset($this->message[$pos]['xattrs'])) {
588 $this->debug('in buildVal, handling attributes');
589 foreach ($this->message[$pos]['xattrs'] as $n => $v) {
594 if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
595 $this->debug('in buildVal, handling simpleContent');
596 if (isset($this->message[$pos]['type'])) {
597 …s['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($t…
599 $parent = $this->message[$pos]['parent'];
600 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
601 … $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($t…
603 $params['!'] = $this->message[$pos]['cdata'];
608 $this->debug('in buildVal, return:');
609 $this->appendDebug($this->varDump($ret));
612 $this->debug('in buildVal, no children, building scalar');
613 $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
614 if (isset($this->message[$pos]['type'])) {
615 …$ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_…
616 $this->debug("in buildVal, return: $ret");
619 $parent = $this->message[$pos]['parent'];
620 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
621 …$ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$par…
622 $this->debug("in buildVal, return: $ret");
625 $ret = $this->message[$pos]['cdata'];
626 $this->debug("in buildVal, return: $ret");