Support Incident Tracker GIT4.x
class.soap_parser.php
Go to the documentation of this file.
00001 <?php
00002 
00003 
00004 
00005 
00015 class nusoap_parser extends nusoap_base {
00016 
00017     var $xml = '';
00018     var $xml_encoding = '';
00019     var $method = '';
00020     var $root_struct = '';
00021     var $root_struct_name = '';
00022     var $root_struct_namespace = '';
00023     var $root_header = '';
00024     var $document = '';         // incoming SOAP body (text)
00025     // determines where in the message we are (envelope,header,body,method)
00026     var $status = '';
00027     var $position = 0;
00028     var $depth = 0;
00029     var $default_namespace = '';
00030     var $namespaces = array();
00031     var $message = array();
00032     var $parent = '';
00033     var $fault = false;
00034     var $fault_code = '';
00035     var $fault_str = '';
00036     var $fault_detail = '';
00037     var $depth_array = array();
00038     var $debug_flag = true;
00039     var $soapresponse = NULL;   // parsed SOAP Body
00040     var $soapheader = NULL;     // parsed SOAP Header
00041     var $responseHeaders = '';  // incoming SOAP headers (text)
00042     var $body_position = 0;
00043     // for multiref parsing:
00044     // array of id => pos
00045     var $ids = array();
00046     // array of id => hrefs => pos
00047     var $multirefs = array();
00048     // toggle for auto-decoding element content
00049     var $decode_utf8 = true;
00050 
00060     function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
00061         parent::nusoap_base();
00062         $this->xml = $xml;
00063         $this->xml_encoding = $encoding;
00064         $this->method = $method;
00065         $this->decode_utf8 = $decode_utf8;
00066 
00067         // Check whether content has been read.
00068         if(!empty($xml)){
00069             // Check XML encoding
00070             $pos_xml = strpos($xml, '<?xml');
00071             if ($pos_xml !== FALSE) {
00072                 $xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
00073                 if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
00074                     $xml_encoding = $res[1];
00075                     if (strtoupper($xml_encoding) != $encoding) {
00076                         $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
00077                         $this->debug($err);
00078                         if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
00079                             $this->setError($err);
00080                             return;
00081                         }
00082                         // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
00083                     } else {
00084                         $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
00085                     }
00086                 } else {
00087                     $this->debug('No encoding specified in XML declaration');
00088                 }
00089             } else {
00090                 $this->debug('No XML declaration');
00091             }
00092             $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
00093             // Create an XML parser - why not xml_parser_create_ns?
00094             $this->parser = xml_parser_create($this->xml_encoding);
00095             // Set the options for parsing the XML data.
00096             //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
00097             xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
00098             xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
00099             // Set the object for the parser.
00100             xml_set_object($this->parser, $this);
00101             // Set the element handlers for the parser.
00102             xml_set_element_handler($this->parser, 'start_element','end_element');
00103             xml_set_character_data_handler($this->parser,'character_data');
00104 
00105             // Parse the XML file.
00106             if(!xml_parse($this->parser,$xml,true)){
00107                 // Display an error message.
00108                 $err = sprintf('XML error parsing SOAP payload on line %d: %s',
00109                 xml_get_current_line_number($this->parser),
00110                 xml_error_string(xml_get_error_code($this->parser)));
00111                 $this->debug($err);
00112                 $this->debug("XML payload:\n" . $xml);
00113                 $this->setError($err);
00114             } else {
00115                 $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
00116                 // get final value
00117                 $this->soapresponse = $this->message[$this->root_struct]['result'];
00118                 // get header value
00119                 if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
00120                     $this->soapheader = $this->message[$this->root_header]['result'];
00121                 }
00122                 // resolve hrefs/ids
00123                 if(sizeof($this->multirefs) > 0){
00124                     foreach($this->multirefs as $id => $hrefs){
00125                         $this->debug('resolving multirefs for id: '.$id);
00126                         $idVal = $this->buildVal($this->ids[$id]);
00127                         if (is_array($idVal) && isset($idVal['!id'])) {
00128                             unset($idVal['!id']);
00129                         }
00130                         foreach($hrefs as $refPos => $ref){
00131                             $this->debug('resolving href at pos '.$refPos);
00132                             $this->multirefs[$id][$refPos] = $idVal;
00133                         }
00134                     }
00135                 }
00136             }
00137             xml_parser_free($this->parser);
00138         } else {
00139             $this->debug('xml was empty, didn\'t parse!');
00140             $this->setError('xml was empty, didn\'t parse!');
00141         }
00142     }
00143 
00152     function start_element($parser, $name, $attrs) {
00153         // position in a total number of elements, starting from 0
00154         // update class level pos
00155         $pos = $this->position++;
00156         // and set mine
00157         $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
00158         // depth = how many levels removed from root?
00159         // set mine as current global depth and increment global depth value
00160         $this->message[$pos]['depth'] = $this->depth++;
00161 
00162         // else add self as child to whoever the current parent is
00163         if($pos != 0){
00164             $this->message[$this->parent]['children'] .= '|'.$pos;
00165         }
00166         // set my parent
00167         $this->message[$pos]['parent'] = $this->parent;
00168         // set self as current parent
00169         $this->parent = $pos;
00170         // set self as current value for this depth
00171         $this->depth_array[$this->depth] = $pos;
00172         // get element prefix
00173         if(strpos($name,':')){
00174             // get ns prefix
00175             $prefix = substr($name,0,strpos($name,':'));
00176             // get unqualified name
00177             $name = substr(strstr($name,':'),1);
00178         }
00179         // set status
00180         if($name == 'Envelope'){
00181             $this->status = 'envelope';
00182         } elseif($name == 'Header' && $this->status = 'envelope'){
00183             $this->root_header = $pos;
00184             $this->status = 'header';
00185         } elseif($name == 'Body' && $this->status = 'envelope'){
00186             $this->status = 'body';
00187             $this->body_position = $pos;
00188         // set method
00189         } elseif($this->status == 'body' && $pos == ($this->body_position+1)){
00190             $this->status = 'method';
00191             $this->root_struct_name = $name;
00192             $this->root_struct = $pos;
00193             $this->message[$pos]['type'] = 'struct';
00194             $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
00195         }
00196         // set my status
00197         $this->message[$pos]['status'] = $this->status;
00198         // set name
00199         $this->message[$pos]['name'] = htmlspecialchars($name);
00200         // set attrs
00201         $this->message[$pos]['attrs'] = $attrs;
00202 
00203         // loop through atts, logging ns and type declarations
00204         $attstr = '';
00205         foreach($attrs as $key => $value){
00206             $key_prefix = $this->getPrefix($key);
00207             $key_localpart = $this->getLocalPart($key);
00208             // if ns declarations, add to class level array of valid namespaces
00209             if($key_prefix == 'xmlns'){
00210                 if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
00211                     $this->XMLSchemaVersion = $value;
00212                     $this->namespaces['xsd'] = $this->XMLSchemaVersion;
00213                     $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
00214                 }
00215                 $this->namespaces[$key_localpart] = $value;
00216                 // set method namespace
00217                 if($name == $this->root_struct_name){
00218                     $this->methodNamespace = $value;
00219                 }
00220             // if it's a type declaration, set type
00221         } elseif($key_localpart == 'type'){
00222                 if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
00223                     // do nothing: already processed arrayType
00224                 } else {
00225                     $value_prefix = $this->getPrefix($value);
00226                     $value_localpart = $this->getLocalPart($value);
00227                     $this->message[$pos]['type'] = $value_localpart;
00228                     $this->message[$pos]['typePrefix'] = $value_prefix;
00229                     if(isset($this->namespaces[$value_prefix])){
00230                         $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
00231                     } else if(isset($attrs['xmlns:'.$value_prefix])) {
00232                         $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
00233                     }
00234                     // should do something here with the namespace of specified type?
00235                 }
00236             } elseif($key_localpart == 'arrayType'){
00237                 $this->message[$pos]['type'] = 'array';
00238                 /* do arrayType ereg here
00239                 [1]    arrayTypeValue    ::=    atype asize
00240                 [2]    atype    ::=    QName rank*
00241                 [3]    rank    ::=    '[' (',')* ']'
00242                 [4]    asize    ::=    '[' length~ ']'
00243                 [5]    length    ::=    nextDimension* Digit+
00244                 [6]    nextDimension    ::=    Digit+ ','
00245                 */
00246                 $expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
00247                 if(ereg($expr,$value,$regs)){
00248                     $this->message[$pos]['typePrefix'] = $regs[1];
00249                     $this->message[$pos]['arrayTypePrefix'] = $regs[1];
00250                     if (isset($this->namespaces[$regs[1]])) {
00251                         $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
00252                     } else if (isset($attrs['xmlns:'.$regs[1]])) {
00253                         $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
00254                     }
00255                     $this->message[$pos]['arrayType'] = $regs[2];
00256                     $this->message[$pos]['arraySize'] = $regs[3];
00257                     $this->message[$pos]['arrayCols'] = $regs[4];
00258                 }
00259             // specifies nil value (or not)
00260             } elseif ($key_localpart == 'nil'){
00261                 $this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
00262             // some other attribute
00263             } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
00264                 $this->message[$pos]['xattrs']['!' . $key] = $value;
00265             }
00266 
00267             if ($key == 'xmlns') {
00268                 $this->default_namespace = $value;
00269             }
00270             // log id
00271             if($key == 'id'){
00272                 $this->ids[$value] = $pos;
00273             }
00274             // root
00275             if($key_localpart == 'root' && $value == 1){
00276                 $this->status = 'method';
00277                 $this->root_struct_name = $name;
00278                 $this->root_struct = $pos;
00279                 $this->debug("found root struct $this->root_struct_name, pos $pos");
00280             }
00281             // for doclit
00282             $attstr .= " $key=\"$value\"";
00283         }
00284         // get namespace - must be done after namespace atts are processed
00285         if(isset($prefix)){
00286             $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
00287             $this->default_namespace = $this->namespaces[$prefix];
00288         } else {
00289             $this->message[$pos]['namespace'] = $this->default_namespace;
00290         }
00291         if($this->status == 'header'){
00292             if ($this->root_header != $pos) {
00293                 $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
00294             }
00295         } elseif($this->root_struct_name != ''){
00296             $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
00297         }
00298     }
00299 
00307     function end_element($parser, $name) {
00308         // position of current element is equal to the last value left in depth_array for my depth
00309         $pos = $this->depth_array[$this->depth--];
00310 
00311         // get element prefix
00312         if(strpos($name,':')){
00313             // get ns prefix
00314             $prefix = substr($name,0,strpos($name,':'));
00315             // get unqualified name
00316             $name = substr(strstr($name,':'),1);
00317         }
00318         
00319         // build to native type
00320         if(isset($this->body_position) && $pos > $this->body_position){
00321             // deal w/ multirefs
00322             if(isset($this->message[$pos]['attrs']['href'])){
00323                 // get id
00324                 $id = substr($this->message[$pos]['attrs']['href'],1);
00325                 // add placeholder to href array
00326                 $this->multirefs[$id][$pos] = 'placeholder';
00327                 // add set a reference to it as the result value
00328                 $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
00329             // build complexType values
00330             } elseif($this->message[$pos]['children'] != ''){
00331                 // if result has already been generated (struct/array)
00332                 if(!isset($this->message[$pos]['result'])){
00333                     $this->message[$pos]['result'] = $this->buildVal($pos);
00334                 }
00335             // build complexType values of attributes and possibly simpleContent
00336             } elseif (isset($this->message[$pos]['xattrs'])) {
00337                 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
00338                     $this->message[$pos]['xattrs']['!'] = null;
00339                 } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
00340                     if (isset($this->message[$pos]['type'])) {
00341                         $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
00342                     } else {
00343                         $parent = $this->message[$pos]['parent'];
00344                         if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
00345                             $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
00346                         } else {
00347                             $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
00348                         }
00349                     }
00350                 }
00351                 $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
00352             // set value of simpleType (or nil complexType)
00353             } else {
00354                 //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
00355                 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
00356                     $this->message[$pos]['xattrs']['!'] = null;
00357                 } elseif (isset($this->message[$pos]['type'])) {
00358                     $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
00359                 } else {
00360                     $parent = $this->message[$pos]['parent'];
00361                     if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
00362                         $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
00363                     } else {
00364                         $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
00365                     }
00366                 }
00367 
00368                 /* add value to parent's result, if parent is struct/array
00369                 $parent = $this->message[$pos]['parent'];
00370                 if($this->message[$parent]['type'] != 'map'){
00371                     if(strtolower($this->message[$parent]['type']) == 'array'){
00372                         $this->message[$parent]['result'][] = $this->message[$pos]['result'];
00373                     } else {
00374                         $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result'];
00375                     }
00376                 }
00377                 */
00378             }
00379         }
00380         
00381         // for doclit
00382         if($this->status == 'header'){
00383             if ($this->root_header != $pos) {
00384                 $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
00385             }
00386         } elseif($pos >= $this->root_struct){
00387             $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
00388         }
00389         // switch status
00390         if($pos == $this->root_struct){
00391             $this->status = 'body';
00392             $this->root_struct_namespace = $this->message[$pos]['namespace'];
00393         } elseif($name == 'Body'){
00394             $this->status = 'envelope';
00395          } elseif($name == 'Header'){
00396             $this->status = 'envelope';
00397         } elseif($name == 'Envelope'){
00398             //
00399         }
00400         // set parent back to my parent
00401         $this->parent = $this->message[$pos]['parent'];
00402     }
00403 
00411     function character_data($parser, $data){
00412         $pos = $this->depth_array[$this->depth];
00413         if ($this->xml_encoding=='UTF-8'){
00414             // TODO: add an option to disable this for folks who want
00415             // raw UTF-8 that, e.g., might not map to iso-8859-1
00416             // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
00417             if($this->decode_utf8){
00418                 $data = utf8_decode($data);
00419             }
00420         }
00421         $this->message[$pos]['cdata'] .= $data;
00422         // for doclit
00423         if($this->status == 'header'){
00424             $this->responseHeaders .= $data;
00425         } else {
00426             $this->document .= $data;
00427         }
00428     }
00429 
00437     function get_response(){
00438         return $this->soapresponse;
00439     }
00440 
00447     function get_soapbody(){
00448         return $this->soapresponse;
00449     }
00450 
00457     function get_soapheader(){
00458         return $this->soapheader;
00459     }
00460 
00467     function getHeaders(){
00468         return $this->responseHeaders;
00469     }
00470 
00480     function decodeSimple($value, $type, $typens) {
00481         // TODO: use the namespace!
00482         if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
00483             return (string) $value;
00484         }
00485         if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
00486             return (int) $value;
00487         }
00488         if ($type == 'float' || $type == 'double' || $type == 'decimal') {
00489             return (double) $value;
00490         }
00491         if ($type == 'boolean') {
00492             if (strtolower($value) == 'false' || strtolower($value) == 'f') {
00493                 return false;
00494             }
00495             return (boolean) $value;
00496         }
00497         if ($type == 'base64' || $type == 'base64Binary') {
00498             $this->debug('Decode base64 value');
00499             return base64_decode($value);
00500         }
00501         // obscure numeric types
00502         if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
00503             || $type == 'nonNegativeInteger' || $type == 'positiveInteger'
00504             || $type == 'unsignedInt'
00505             || $type == 'unsignedShort' || $type == 'unsignedByte') {
00506             return (int) $value;
00507         }
00508         // bogus: parser treats array with no elements as a simple type
00509         if ($type == 'array') {
00510             return array();
00511         }
00512         // everything else
00513         return (string) $value;
00514     }
00515 
00524     function buildVal($pos){
00525         if(!isset($this->message[$pos]['type'])){
00526             $this->message[$pos]['type'] = '';
00527         }
00528         $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
00529         // if there are children...
00530         if($this->message[$pos]['children'] != ''){
00531             $this->debug('in buildVal, there are children');
00532             $children = explode('|',$this->message[$pos]['children']);
00533             array_shift($children); // knock off empty
00534             // md array
00535             if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
00536                 $r=0; // rowcount
00537                 $c=0; // colcount
00538                 foreach($children as $child_pos){
00539                     $this->debug("in buildVal, got an MD array element: $r, $c");
00540                     $params[$r][] = $this->message[$child_pos]['result'];
00541                     $c++;
00542                     if($c == $this->message[$pos]['arrayCols']){
00543                         $c = 0;
00544                         $r++;
00545                     }
00546                 }
00547             // array
00548             } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
00549                 $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
00550                 foreach($children as $child_pos){
00551                     $params[] = &$this->message[$child_pos]['result'];
00552                 }
00553             // apache Map type: java hashtable
00554             } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
00555                 $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
00556                 foreach($children as $child_pos){
00557                     $kv = explode("|",$this->message[$child_pos]['children']);
00558                     $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
00559                 }
00560             // generic compound type
00561             //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
00562             } else {
00563                 // Apache Vector type: treat as an array
00564                 $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']);
00565                 if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
00566                     $notstruct = 1;
00567                 } else {
00568                     $notstruct = 0;
00569                 }
00570                 //
00571                 foreach($children as $child_pos){
00572                     if($notstruct){
00573                         $params[] = &$this->message[$child_pos]['result'];
00574                     } else {
00575                         if (isset($params[$this->message[$child_pos]['name']])) {
00576                             // de-serialize repeated element name into an array
00577                             if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
00578                                 $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
00579                             }
00580                             $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
00581                         } else {
00582                             $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
00583                         }
00584                     }
00585                 }
00586             }
00587             if (isset($this->message[$pos]['xattrs'])) {
00588                 $this->debug('in buildVal, handling attributes');
00589                 foreach ($this->message[$pos]['xattrs'] as $n => $v) {
00590                     $params[$n] = $v;
00591                 }
00592             }
00593             // handle simpleContent
00594             if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
00595                 $this->debug('in buildVal, handling simpleContent');
00596                 if (isset($this->message[$pos]['type'])) {
00597                     $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
00598                 } else {
00599                     $parent = $this->message[$pos]['parent'];
00600                     if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
00601                         $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
00602                     } else {
00603                         $params['!'] = $this->message[$pos]['cdata'];
00604                     }
00605                 }
00606             }
00607             $ret = is_array($params) ? $params : array();
00608             $this->debug('in buildVal, return:');
00609             $this->appendDebug($this->varDump($ret));
00610             return $ret;
00611         } else {
00612             $this->debug('in buildVal, no children, building scalar');
00613             $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
00614             if (isset($this->message[$pos]['type'])) {
00615                 $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
00616                 $this->debug("in buildVal, return: $ret");
00617                 return $ret;
00618             }
00619             $parent = $this->message[$pos]['parent'];
00620             if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
00621                 $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
00622                 $this->debug("in buildVal, return: $ret");
00623                 return $ret;
00624             }
00625             $ret = $this->message[$pos]['cdata'];
00626             $this->debug("in buildVal, return: $ret");
00627             return $ret;
00628         }
00629     }
00630 }
00631 
00635 class soap_parser extends nusoap_parser {
00636 }
00637 
00638 
00639 ?>