ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
soap_parser Class Reference

soap_parser class parses SOAP XML messages into native PHP values More...

+ Inheritance diagram for soap_parser:
+ Collaboration diagram for soap_parser:

Public Member Functions

 soap_parser ($xml, $encoding='UTF-8', $method='', $decode_utf8=false)
 constructor More...
 
 start_element ($parser, $name, $attrs)
 start-element handler More...
 
 end_element ($parser, $name)
 end-element handler More...
 
 character_data ($parser, $data)
 element content handler More...
 
 get_response ()
 get the parsed message More...
 
 getHeaders ()
 get the parsed headers More...
 
 decode_entities ($text)
 decodes entities More...
 
 decodeSimple ($value, $type, $typens)
 decodes simple types into PHP variables More...
 
 buildVal ($pos)
 builds response structures for compound values (arrays/structs) More...
 
- Public Member Functions inherited from nusoap_base
 debug ($string)
 adds debug data to the class level debug string More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
 serialize message More...
 
 formatDump ($str)
 
 contractQname ($qname)
 contracts a qualified name More...
 
 expandQname ($qname)
 expands a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace returns false if no namespace registered with the given prefix More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 varDump ($data)
 
 nusoap_base ()
 constructor More...
 
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances More...
 
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances More...
 
 getDebugLevel ()
 gets the debug level for this instance More...
 
 setDebugLevel ($level)
 sets the debug level for this instance More...
 
 debug ($string)
 adds debug data to the instance debug string with formatting More...
 
 appendDebug ($string)
 adds debug data to the instance debug string without formatting More...
 
 clearDebug ()
 clears the current debug data for this instance More...
 
getDebug ()
 gets the current debug data for this instance More...
 
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message More...
 
 formatDump ($str)
 formats a string to be inserted into an HTML stream More...
 
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name More...
 
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds More...
 
 varDump ($data)
 Returns a string with the output of var_dump. More...
 
 __toString ()
 represents the object as a string More...
 
- Public Member Functions inherited from nusoap_parser
 nusoap_parser ($xml, $encoding='UTF-8', $method='', $decode_utf8=true)
 constructor that actually does the parsing More...
 
 start_element ($parser, $name, $attrs)
 start-element handler More...
 
 end_element ($parser, $name)
 end-element handler More...
 
 character_data ($parser, $data)
 element content handler More...
 
 get_response ()
 get the parsed message (SOAP Body) More...
 
 get_soapbody ()
 get the parsed SOAP Body (NULL if there was none) More...
 
 get_soapheader ()
 get the parsed SOAP Header (NULL if there was none) More...
 
 getHeaders ()
 get the unparsed SOAP Header More...
 
 decodeSimple ($value, $type, $typens)
 decodes simple types into PHP variables More...
 
 buildVal ($pos)
 builds response structures for compound values (arrays/structs) and scalars More...
 

Data Fields

 $xml = ''
 
 $xml_encoding = ''
 
 $method = ''
 
 $root_struct = ''
 
 $root_struct_name = ''
 
 $root_struct_namespace = ''
 
 $root_header = ''
 
 $document = ''
 
 $status = ''
 
 $position = 0
 
 $depth = 0
 
 $default_namespace = ''
 
 $namespaces = array()
 
 $message = array()
 
 $parent = ''
 
 $fault = false
 
 $fault_code = ''
 
 $fault_str = ''
 
 $fault_detail = ''
 
 $depth_array = array()
 
 $debug_flag = true
 
 $soapresponse = NULL
 
 $responseHeaders = ''
 
 $body_position = 0
 
 $ids = array()
 
 $multirefs = array()
 
 $decode_utf8 = false
 
- Data Fields inherited from nusoap_base
 $title = 'NuSOAP'
 
 $version = '0.6.7'
 
 $revision = '$Revision$'
 
 $error_str = false
 Current error string (manipulated by getError/setError) More...
 
 $debug_str = ''
 Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) More...
 
 $charencoding = true
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 
 $debugLevel
 
- Data Fields inherited from nusoap_parser
 $xml = ''
 
 $xml_encoding = ''
 
 $method = ''
 
 $root_struct = ''
 
 $root_struct_name = ''
 
 $root_struct_namespace = ''
 
 $root_header = ''
 
 $document = ''
 
 $status = ''
 
 $position = 0
 
 $depth = 0
 
 $default_namespace = ''
 
 $namespaces = array()
 
 $message = array()
 
 $parent = ''
 
 $fault = false
 
 $fault_code = ''
 
 $fault_str = ''
 
 $fault_detail = ''
 
 $depth_array = array()
 
 $debug_flag = true
 
 $soapresponse = NULL
 
 $soapheader = NULL
 
 $responseHeaders = ''
 
 $body_position = 0
 
 $ids = array()
 
 $multirefs = array()
 
 $decode_utf8 = true
 

Detailed Description

soap_parser class parses SOAP XML messages into native PHP values

Backward compatibility.

Author
Dietrich Ayala dietr.nosp@m.ich@.nosp@m.ganx4.nosp@m..com @access public

Definition at line 4431 of file nusoap.php.

Member Function Documentation

◆ buildVal()

soap_parser::buildVal (   $pos)

builds response structures for compound values (arrays/structs)

Parameters
string$posposition in node tree @access private

Reimplemented from nusoap_parser.

Definition at line 4865 of file nusoap.php.

4865 {
4866 if(!isset($this->message[$pos]['type'])){
4867 $this->message[$pos]['type'] = '';
4868 }
4869 $this->debug('inside buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
4870 // if there are children...
4871 if($this->message[$pos]['children'] != ''){
4872 $children = explode('|',$this->message[$pos]['children']);
4873 array_shift($children); // knock off empty
4874 // md array
4875 if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
4876 $r=0; // rowcount
4877 $c=0; // colcount
4878 foreach($children as $child_pos){
4879 $this->debug("got an MD array element: $r, $c");
4880 $params[$r][] = $this->message[$child_pos]['result'];
4881 $c++;
4882 if($c == $this->message[$pos]['arrayCols']){
4883 $c = 0;
4884 $r++;
4885 }
4886 }
4887 // array
4888 } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
4889 $this->debug('adding array '.$this->message[$pos]['name']);
4890 foreach($children as $child_pos){
4891 $params[] = &$this->message[$child_pos]['result'];
4892 }
4893 // apache Map type: java hashtable
4894 } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
4895 foreach($children as $child_pos){
4896 $kv = explode("|",$this->message[$child_pos]['children']);
4897 $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
4898 }
4899 // generic compound type
4900 //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
4901 } else {
4902 // Apache Vector type: treat as an array
4903 if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
4904 $notstruct = 1;
4905 } else {
4906 // is array or struct?
4907 foreach($children as $child_pos){
4908 if(isset($keys) && isset($keys[$this->message[$child_pos]['name']])){
4909 $notstruct = 1;
4910 break;
4911 }
4912 $keys[$this->message[$child_pos]['name']] = 1;
4913 }
4914 }
4915 //
4916 foreach($children as $child_pos){
4917 if(isset($notstruct)){
4918 $params[] = &$this->message[$child_pos]['result'];
4919 } else {
4920 if (isset($params[$this->message[$child_pos]['name']])) {
4921 // de-serialize repeated element name into an array
4922 if (!is_array($params[$this->message[$child_pos]['name']])) {
4923 $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
4924 }
4925 $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
4926 } else {
4927 $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
4928 }
4929 }
4930 }
4931 }
4932 return is_array($params) ? $params : array();
4933 } else {
4934 $this->debug('no children');
4935 if(strpos($this->message[$pos]['cdata'],'&')){
4936 return strtr($this->message[$pos]['cdata'],array_flip($this->entities));
4937 } else {
4938 return $this->message[$pos]['cdata'];
4939 }
4940 }
4941 }
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$r
Definition: example_031.php:79
$params
Definition: example_049.php:96

References $params, $r, and nusoap_base\debug().

Referenced by end_element(), and soap_parser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ character_data()

soap_parser::character_data (   $parser,
  $data 
)

element content handler

Parameters
string$parserXML parser object
string$dataelement content @access private

Reimplemented from nusoap_parser.

Definition at line 4768 of file nusoap.php.

4768 {
4769 $pos = $this->depth_array[$this->depth];
4770 if ($this->xml_encoding=='UTF-8'){
4771 // TODO: add an option to disable this for folks who want
4772 // raw UTF-8 that, e.g., might not map to iso-8859-1
4773 // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
4774 if($this->decode_utf8){
4775 $data = utf8_decode($data);
4776 }
4777 }
4778 $this->message[$pos]['cdata'] .= $data;
4779 // for doclit
4780 if($this->status == 'header'){
4781 $this->responseHeaders .= $data;
4782 } else {
4783 $this->document .= $data;
4784 }
4785 }
$data

References $data, and $depth.

◆ decode_entities()

soap_parser::decode_entities (   $text)

decodes entities

Parameters
string$textstring to translate @access private

Definition at line 4813 of file nusoap.php.

4813 {
4814 foreach($this->entities as $entity => $encoded){
4815 $text = str_replace($encoded,$entity,$text);
4816 }
4817 return $text;
4818 }
$text

References $text.

◆ decodeSimple()

soap_parser::decodeSimple (   $value,
  $type,
  $typens 
)

decodes simple types into PHP variables

Parameters
string$valuevalue to decode
string$typeXML type to decode
string$typensXML type namespace to decode @access private

Reimplemented from nusoap_parser.

Definition at line 4828 of file nusoap.php.

4828 {
4829 // TODO: use the namespace!
4830 if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
4831 return (string) $value;
4832 }
4833 if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
4834 return (int) $value;
4835 }
4836 if ($type == 'float' || $type == 'double' || $type == 'decimal') {
4837 return (double) $value;
4838 }
4839 if ($type == 'boolean') {
4840 if (strtolower($value) == 'false' || strtolower($value) == 'f') {
4841 return false;
4842 }
4843 return (boolean) $value;
4844 }
4845 if ($type == 'base64' || $type == 'base64Binary') {
4846 return base64_decode($value);
4847 }
4848 // obscure numeric types
4849 if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
4850 || $type == 'nonNegativeInteger' || $type == 'positiveInteger'
4851 || $type == 'unsignedInt'
4852 || $type == 'unsignedShort' || $type == 'unsignedByte') {
4853 return (int) $value;
4854 }
4855 // everything else
4856 return (string) $value;
4857 }

Referenced by end_element().

+ Here is the caller graph for this function:

◆ end_element()

soap_parser::end_element (   $parser,
  $name 
)

end-element handler

Parameters
string$parserXML parser object
string$nameelement name @access private

Reimplemented from nusoap_parser.

Definition at line 4681 of file nusoap.php.

4681 {
4682 // position of current element is equal to the last value left in depth_array for my depth
4683 $pos = $this->depth_array[$this->depth--];
4684
4685 // get element prefix
4686 if(strpos($name,':')){
4687 // get ns prefix
4688 $prefix = substr($name,0,strpos($name,':'));
4689 // get unqualified name
4690 $name = substr(strstr($name,':'),1);
4691 }
4692
4693 // build to native type
4694 if(isset($this->body_position) && $pos > $this->body_position){
4695 // deal w/ multirefs
4696 if(isset($this->message[$pos]['attrs']['href'])){
4697 // get id
4698 $id = substr($this->message[$pos]['attrs']['href'],1);
4699 // add placeholder to href array
4700 $this->multirefs[$id][$pos] = 'placeholder';
4701 // add set a reference to it as the result value
4702 $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
4703 // build complex values
4704 } elseif($this->message[$pos]['children'] != ''){
4705
4706 // if result has already been generated (struct/array
4707 if(!isset($this->message[$pos]['result'])){
4708 $this->message[$pos]['result'] = $this->buildVal($pos);
4709 }
4710
4711 // set value of simple type
4712 } else {
4713 //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
4714 if (isset($this->message[$pos]['type'])) {
4715 $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'] : '');
4716 } else {
4717 $parent = $this->message[$pos]['parent'];
4718 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
4719 $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
4720 } else {
4721 $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
4722 }
4723 }
4724
4725 /* add value to parent's result, if parent is struct/array
4726 $parent = $this->message[$pos]['parent'];
4727 if($this->message[$parent]['type'] != 'map'){
4728 if(strtolower($this->message[$parent]['type']) == 'array'){
4729 $this->message[$parent]['result'][] = $this->message[$pos]['result'];
4730 } else {
4731 $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result'];
4732 }
4733 }
4734 */
4735 }
4736 }
4737
4738 // for doclit
4739 if($this->status == 'header'){
4740 if ($this->root_header != $pos) {
4741 $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
4742 }
4743 } elseif($pos >= $this->root_struct){
4744 $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
4745 }
4746 // switch status
4747 if($pos == $this->root_struct){
4748 $this->status = 'body';
4749 $this->root_struct_namespace = $this->message[$pos]['namespace'];
4750 } elseif($name == 'Body'){
4751 $this->status = 'envelope';
4752 } elseif($name == 'Header'){
4753 $this->status = 'envelope';
4754 } elseif($name == 'Envelope'){
4755 //
4756 }
4757 // set parent back to my parent
4758 $this->parent = $this->message[$pos]['parent'];
4759 }
buildVal($pos)
builds response structures for compound values (arrays/structs)
Definition: nusoap.php:4865
decodeSimple($value, $type, $typens)
decodes simple types into PHP variables
Definition: nusoap.php:4828

References $parent, buildVal(), and decodeSimple().

+ Here is the call graph for this function:

◆ get_response()

soap_parser::get_response ( )

get the parsed message

Returns
mixed @access public

Reimplemented from nusoap_parser.

Definition at line 4793 of file nusoap.php.

4793 {
4794 return $this->soapresponse;
4795 }

References $soapresponse.

◆ getHeaders()

soap_parser::getHeaders ( )

get the parsed headers

Returns
string XML or empty if no headers @access public

Reimplemented from nusoap_parser.

Definition at line 4803 of file nusoap.php.

4803 {
4805 }

References $responseHeaders.

◆ soap_parser()

soap_parser::soap_parser (   $xml,
  $encoding = 'UTF-8',
  $method = '',
  $decode_utf8 = false 
)

constructor

Parameters
string$xmlSOAP message
string$encodingcharacter encoding scheme of message
string$method
string$decode_utf8whether to decode UTF-8 to ISO-8859-1 @access public

Definition at line 4475 of file nusoap.php.

4475 {
4476 $this->xml = $xml;
4477 $this->xml_encoding = $encoding;
4478 $this->method = $method;
4479 $this->decode_utf8 = $decode_utf8;
4480
4481 // Check whether content has been read.
4482 if(!empty($xml)){
4483 $this->debug('Entering soap_parser(), length='.strlen($xml).', encoding='.$encoding);
4484 // Create an XML parser - why not xml_parser_create_ns?
4485 $this->parser = xml_parser_create($this->xml_encoding);
4486 // Set the options for parsing the XML data.
4487 //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
4488 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
4489 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
4490 // Set the object for the parser.
4491 xml_set_object($this->parser, $this);
4492 // Set the element handlers for the parser.
4493 xml_set_element_handler($this->parser, 'start_element','end_element');
4494 xml_set_character_data_handler($this->parser,'character_data');
4495
4496 // Parse the XML file.
4497 if(!xml_parse($this->parser,$xml,true)){
4498 // Display an error message.
4499 $err = sprintf('XML error parsing SOAP payload on line %d: %s',
4500 xml_get_current_line_number($this->parser),
4501 xml_error_string(xml_get_error_code($this->parser)));
4502 $this->debug($err);
4503 $this->debug("XML payload:\n" . $xml);
4504 $this->setError($err);
4505 } else {
4506 $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
4507 // get final value
4508 $this->soapresponse = $this->message[$this->root_struct]['result'];
4509 // get header value: no, because this is documented as XML string
4510// if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
4511// $this->responseHeaders = $this->message[$this->root_header]['result'];
4512// }
4513 // resolve hrefs/ids
4514 if(sizeof($this->multirefs) > 0){
4515 foreach($this->multirefs as $id => $hrefs){
4516 $this->debug('resolving multirefs for id: '.$id);
4517 $idVal = $this->buildVal($this->ids[$id]);
4518 foreach($hrefs as $refPos => $ref){
4519 $this->debug('resolving href at pos '.$refPos);
4520 $this->multirefs[$id][$refPos] = $idVal;
4521 }
4522 }
4523 }
4524 }
4525 xml_parser_free($this->parser);
4526 } else {
4527 $this->debug('xml was empty, didn\'t parse!');
4528 $this->setError('xml was empty, didn\'t parse!');
4529 }
4530 }
setError($str)
sets error string
Definition: nusoap.php:184

References $decode_utf8, $method, $root_struct, $xml, buildVal(), nusoap_base\debug(), and nusoap_base\setError().

+ Here is the call graph for this function:

◆ start_element()

soap_parser::start_element (   $parser,
  $name,
  $attrs 
)

start-element handler

Parameters
string$parserXML parser object
string$nameelement name
string$attrsassociative array of attributes @access private

Reimplemented from nusoap_parser.

Definition at line 4540 of file nusoap.php.

4540 {
4541 // position in a total number of elements, starting from 0
4542 // update class level pos
4543 $pos = $this->position++;
4544 // and set mine
4545 $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
4546 // depth = how many levels removed from root?
4547 // set mine as current global depth and increment global depth value
4548 $this->message[$pos]['depth'] = $this->depth++;
4549
4550 // else add self as child to whoever the current parent is
4551 if($pos != 0){
4552 $this->message[$this->parent]['children'] .= '|'.$pos;
4553 }
4554 // set my parent
4555 $this->message[$pos]['parent'] = $this->parent;
4556 // set self as current parent
4557 $this->parent = $pos;
4558 // set self as current value for this depth
4559 $this->depth_array[$this->depth] = $pos;
4560 // get element prefix
4561 if(strpos($name,':')){
4562 // get ns prefix
4563 $prefix = substr($name,0,strpos($name,':'));
4564 // get unqualified name
4565 $name = substr(strstr($name,':'),1);
4566 }
4567 // set status
4568 if($name == 'Envelope'){
4569 $this->status = 'envelope';
4570 } elseif($name == 'Header'){
4571 $this->root_header = $pos;
4572 $this->status = 'header';
4573 } elseif($name == 'Body'){
4574 $this->status = 'body';
4575 $this->body_position = $pos;
4576 // set method
4577 } elseif($this->status == 'body' && $pos == ($this->body_position+1)){
4578 $this->status = 'method';
4579 $this->root_struct_name = $name;
4580 $this->root_struct = $pos;
4581 $this->message[$pos]['type'] = 'struct';
4582 $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
4583 }
4584 // set my status
4585 $this->message[$pos]['status'] = $this->status;
4586 // set name
4587 $this->message[$pos]['name'] = htmlspecialchars($name);
4588 // set attrs
4589 $this->message[$pos]['attrs'] = $attrs;
4590
4591 // loop through atts, logging ns and type declarations
4592 $attstr = '';
4593 foreach($attrs as $key => $value){
4594 $key_prefix = $this->getPrefix($key);
4595 $key_localpart = $this->getLocalPart($key);
4596 // if ns declarations, add to class level array of valid namespaces
4597 if($key_prefix == 'xmlns'){
4598 if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
4599 $this->XMLSchemaVersion = $value;
4600 $this->namespaces['xsd'] = $this->XMLSchemaVersion;
4601 $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
4602 }
4603 $this->namespaces[$key_localpart] = $value;
4604 // set method namespace
4605 if($name == $this->root_struct_name){
4606 $this->methodNamespace = $value;
4607 }
4608 // if it's a type declaration, set type
4609 } elseif($key_localpart == 'type'){
4610 $value_prefix = $this->getPrefix($value);
4611 $value_localpart = $this->getLocalPart($value);
4612 $this->message[$pos]['type'] = $value_localpart;
4613 $this->message[$pos]['typePrefix'] = $value_prefix;
4614 if(isset($this->namespaces[$value_prefix])){
4615 $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
4616 } else if(isset($attrs['xmlns:'.$value_prefix])) {
4617 $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
4618 }
4619 // should do something here with the namespace of specified type?
4620 } elseif($key_localpart == 'arrayType'){
4621 $this->message[$pos]['type'] = 'array';
4622 /* do arrayType ereg here
4623 [1] arrayTypeValue ::= atype asize
4624 [2] atype ::= QName rank*
4625 [3] rank ::= '[' (',')* ']'
4626 [4] asize ::= '[' length~ ']'
4627 [5] length ::= nextDimension* Digit+
4628 [6] nextDimension ::= Digit+ ','
4629 */
4630 $expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
4631 if(ereg($expr,$value,$regs)){
4632 $this->message[$pos]['typePrefix'] = $regs[1];
4633 $this->message[$pos]['arrayTypePrefix'] = $regs[1];
4634 if (isset($this->namespaces[$regs[1]])) {
4635 $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
4636 } else if (isset($attrs['xmlns:'.$regs[1]])) {
4637 $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
4638 }
4639 $this->message[$pos]['arrayType'] = $regs[2];
4640 $this->message[$pos]['arraySize'] = $regs[3];
4641 $this->message[$pos]['arrayCols'] = $regs[4];
4642 }
4643 }
4644 // log id
4645 if($key == 'id'){
4646 $this->ids[$value] = $pos;
4647 }
4648 // root
4649 if($key_localpart == 'root' && $value == 1){
4650 $this->status = 'method';
4651 $this->root_struct_name = $name;
4652 $this->root_struct = $pos;
4653 $this->debug("found root struct $this->root_struct_name, pos $pos");
4654 }
4655 // for doclit
4656 $attstr .= " $key=\"$value\"";
4657 }
4658 // get namespace - must be done after namespace atts are processed
4659 if(isset($prefix)){
4660 $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
4661 $this->default_namespace = $this->namespaces[$prefix];
4662 } else {
4663 $this->message[$pos]['namespace'] = $this->default_namespace;
4664 }
4665 if($this->status == 'header'){
4666 if ($this->root_header != $pos) {
4667 $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
4668 }
4669 } elseif($this->root_struct_name != ''){
4670 $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
4671 }
4672 }
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:525
$XMLSchemaVersion
Definition: nusoap.php:78
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed
Definition: nusoap.php:508
$default_namespace
Definition: nusoap.php:4445

References $default_namespace, $depth, $parent, $status, nusoap_base\$XMLSchemaVersion, nusoap_base\debug(), nusoap_base\getLocalPart(), and nusoap_base\getPrefix().

+ Here is the call graph for this function:

Field Documentation

◆ $body_position

soap_parser::$body_position = 0

Definition at line 4457 of file nusoap.php.

◆ $debug_flag

soap_parser::$debug_flag = true

Definition at line 4454 of file nusoap.php.

◆ $decode_utf8

soap_parser::$decode_utf8 = false

Definition at line 4464 of file nusoap.php.

Referenced by soap_parser().

◆ $default_namespace

soap_parser::$default_namespace = ''

Definition at line 4445 of file nusoap.php.

Referenced by start_element().

◆ $depth

soap_parser::$depth = 0

Definition at line 4444 of file nusoap.php.

Referenced by character_data(), and start_element().

◆ $depth_array

soap_parser::$depth_array = array()

Definition at line 4453 of file nusoap.php.

◆ $document

soap_parser::$document = ''

Definition at line 4440 of file nusoap.php.

◆ $fault

soap_parser::$fault = false

Definition at line 4449 of file nusoap.php.

◆ $fault_code

soap_parser::$fault_code = ''

Definition at line 4450 of file nusoap.php.

◆ $fault_detail

soap_parser::$fault_detail = ''

Definition at line 4452 of file nusoap.php.

◆ $fault_str

soap_parser::$fault_str = ''

Definition at line 4451 of file nusoap.php.

◆ $ids

soap_parser::$ids = array()

Definition at line 4460 of file nusoap.php.

◆ $message

soap_parser::$message = array()

Definition at line 4447 of file nusoap.php.

◆ $method

soap_parser::$method = ''

Definition at line 4435 of file nusoap.php.

Referenced by soap_parser().

◆ $multirefs

soap_parser::$multirefs = array()

Definition at line 4462 of file nusoap.php.

◆ $namespaces

soap_parser::$namespaces = array()

Definition at line 4446 of file nusoap.php.

◆ $parent

soap_parser::$parent = ''

Definition at line 4448 of file nusoap.php.

Referenced by end_element(), and start_element().

◆ $position

soap_parser::$position = 0

Definition at line 4443 of file nusoap.php.

◆ $responseHeaders

soap_parser::$responseHeaders = ''

Definition at line 4456 of file nusoap.php.

Referenced by getHeaders().

◆ $root_header

soap_parser::$root_header = ''

Definition at line 4439 of file nusoap.php.

◆ $root_struct

soap_parser::$root_struct = ''

Definition at line 4436 of file nusoap.php.

Referenced by soap_parser().

◆ $root_struct_name

soap_parser::$root_struct_name = ''

Definition at line 4437 of file nusoap.php.

◆ $root_struct_namespace

soap_parser::$root_struct_namespace = ''

Definition at line 4438 of file nusoap.php.

◆ $soapresponse

soap_parser::$soapresponse = NULL

Definition at line 4455 of file nusoap.php.

Referenced by get_response().

◆ $status

soap_parser::$status = ''

Definition at line 4442 of file nusoap.php.

Referenced by start_element().

◆ $xml

soap_parser::$xml = ''

Definition at line 4433 of file nusoap.php.

Referenced by soap_parser().

◆ $xml_encoding

soap_parser::$xml_encoding = ''

Definition at line 4434 of file nusoap.php.


The documentation for this class was generated from the following file: