ILIAS  release_8 Revision v8.24
nusoap_parser Class Reference

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

+ Inheritance diagram for nusoap_parser:
+ Collaboration diagram for nusoap_parser:

Public Member Functions

 __construct ($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...
 
- Public Member Functions inherited from nusoap_base
 __construct ()
 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)
 serializes PHP values in accordance w/ section 5. More...
 
 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...
 

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
 
 $soapheader = null
 
 $responseHeaders = ''
 
 $body_position = 0
 
 $ids = array()
 
 $multirefs = array()
 
 $decode_utf8 = true
 
- Data Fields inherited from nusoap_base
 $title = 'NuSOAP'
 
 $version = '0.7.3'
 
 $revision = '$Revision$'
 
 $error_str = ''
 
 $debug_str = ''
 
 $charencoding = true
 
 $debugLevel
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 

Detailed Description

nusoap_parser class parses SOAP XML messages into native PHP values

Author
Dietrich Ayala dietr.nosp@m.ich@.nosp@m.ganx4.nosp@m..com
Scott Nichol snich.nosp@m.ol@u.nosp@m.sers..nosp@m.sour.nosp@m.cefor.nosp@m.ge.n.nosp@m.et
Version
$Id$ @access public

Definition at line 6545 of file nusoap.php.

Constructor & Destructor Documentation

◆ __construct()

nusoap_parser::__construct (   $xml,
  $encoding = 'UTF-8',
  $method = '',
  $decode_utf8 = true 
)

constructor that actually does the parsing

Parameters
string$xmlSOAP message
string$encodingcharacter encoding scheme of message
string$methodmethod for which XML is parsed (unused?)
string$decode_utf8whether to decode UTF-8 to ISO-8859-1 @access public

Definition at line 6590 of file nusoap.php.

6591 {
6593 $this->xml = $xml;
6594 $this->xml_encoding = $encoding;
6595 $this->method = $method;
6596 $this->decode_utf8 = $decode_utf8;
6597
6598 // Check whether content has been read.
6599 if (!empty($xml)) {
6600 // Check XML encoding
6601 $pos_xml = strpos($xml, '<?xml');
6602 if ($pos_xml !== false) {
6603 $xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
6604 if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
6605 $xml_encoding = $res[1];
6606 if (strtoupper($xml_encoding) != $encoding) {
6607 $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
6608 $this->debug($err);
6609 if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
6610 $this->setError($err);
6611 return;
6612 }
6613 // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
6614 } else {
6615 $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
6616 }
6617 } else {
6618 $this->debug('No encoding specified in XML declaration');
6619 }
6620 } else {
6621 $this->debug('No XML declaration');
6622 }
6623 $this->debug('Entering nusoap_parser(), length=' . strlen($xml) . ', encoding=' . $encoding);
6624 // Create an XML parser - why not xml_parser_create_ns?
6625 $this->parser = xml_parser_create($this->xml_encoding);
6626 // Set the options for parsing the XML data.
6627 //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
6628 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
6629 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
6630 // Set the object for the parser.
6631 xml_set_object($this->parser, $this);
6632 // Set the element handlers for the parser.
6633 xml_set_element_handler($this->parser, 'start_element', 'end_element');
6634 xml_set_character_data_handler($this->parser, 'character_data');
6635
6636 // Parse the XML file.
6637 if (!xml_parse($this->parser, $xml, true)) {
6638 // Display an error message.
6639 $err = sprintf(
6640 'XML error parsing SOAP payload on line %d: %s',
6641 xml_get_current_line_number($this->parser),
6642 xml_error_string(xml_get_error_code($this->parser))
6643 );
6644 $this->debug($err);
6645 $this->debug("XML payload:\n" . $xml);
6646 $this->setError($err);
6647 } else {
6648 $this->debug('parsed successfully, found root struct: ' . $this->root_struct . ' of name ' . $this->root_struct_name);
6649 // get final value
6650 $this->soapresponse = $this->message[$this->root_struct]['result'];
6651 // get header value
6652 if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) {
6653 $this->soapheader = $this->message[$this->root_header]['result'];
6654 }
6655 // resolve hrefs/ids
6656 if (sizeof($this->multirefs) > 0) {
6657 foreach ($this->multirefs as $id => $hrefs) {
6658 $this->debug('resolving multirefs for id: ' . $id);
6659 $idVal = $this->buildVal($this->ids[$id]);
6660 if (is_array($idVal) && isset($idVal['!id'])) {
6661 unset($idVal['!id']);
6662 }
6663 foreach ($hrefs as $refPos => $ref) {
6664 $this->debug('resolving href at pos ' . $refPos);
6665 $this->multirefs[$id][$refPos] = $idVal;
6666 }
6667 }
6668 }
6669 }
6670 xml_parser_free($this->parser);
6671 } else {
6672 $this->debug('xml was empty, didn\'t parse!');
6673 $this->setError('xml was empty, didn\'t parse!');
6674 }
6675 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setError($str)
sets error string
Definition: nusoap.php:395
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
buildVal($pos)
builds response structures for compound values (arrays/structs) and scalars
Definition: nusoap.php:7065
$res
Definition: ltiservices.php:69
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $decode_utf8, $id, $method, $res, $root_header, $root_struct, $xml, $xml_encoding, ILIAS\GlobalScreen\Provider\__construct(), buildVal(), nusoap_base\debug(), and nusoap_base\setError().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildVal()

nusoap_parser::buildVal (   $pos)

builds response structures for compound values (arrays/structs) and scalars

Parameters
integer$posposition in node tree
Returns
mixed PHP value @access private

Definition at line 7065 of file nusoap.php.

7066 {
7067 if (!isset($this->message[$pos]['type'])) {
7068 $this->message[$pos]['type'] = '';
7069 }
7070 $this->debug('in buildVal() for ' . $this->message[$pos]['name'] . "(pos $pos) of type " . $this->message[$pos]['type']);
7071 // if there are children...
7072 if ($this->message[$pos]['children'] != '') {
7073 $this->debug('in buildVal, there are children');
7074 $children = explode('|', $this->message[$pos]['children']);
7075 array_shift($children); // knock off empty
7076 // md array
7077 if (isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != '') {
7078 $r=0; // rowcount
7079 $c=0; // colcount
7080 foreach ($children as $child_pos) {
7081 $this->debug("in buildVal, got an MD array element: $r, $c");
7082 $params[$r][] = $this->message[$child_pos]['result'];
7083 $c++;
7084 if ($c == $this->message[$pos]['arrayCols']) {
7085 $c = 0;
7086 $r++;
7087 }
7088 }
7089 // array
7090 } elseif ($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array') {
7091 $this->debug('in buildVal, adding array ' . $this->message[$pos]['name']);
7092 foreach ($children as $child_pos) {
7093 $params[] = &$this->message[$child_pos]['result'];
7094 }
7095 // apache Map type: java hashtable
7096 } elseif ($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
7097 $this->debug('in buildVal, Java Map ' . $this->message[$pos]['name']);
7098 foreach ($children as $child_pos) {
7099 $kv = explode("|", $this->message[$child_pos]['children']);
7100 $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
7101 }
7102 // generic compound type
7103 //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
7104 } else {
7105 // Apache Vector type: treat as an array
7106 $this->debug('in buildVal, adding Java Vector or generic compound type ' . $this->message[$pos]['name']);
7107 if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
7108 $notstruct = 1;
7109 } else {
7110 $notstruct = 0;
7111 }
7112 //
7113 foreach ($children as $child_pos) {
7114 if ($notstruct) {
7115 $params[] = &$this->message[$child_pos]['result'];
7116 } else {
7117 if (isset($params[$this->message[$child_pos]['name']])) {
7118 // de-serialize repeated element name into an array
7119 if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
7120 $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
7121 }
7122 $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
7123 } else {
7124 $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
7125 }
7126 }
7127 }
7128 }
7129 if (isset($this->message[$pos]['xattrs'])) {
7130 $this->debug('in buildVal, handling attributes');
7131 foreach ($this->message[$pos]['xattrs'] as $n => $v) {
7132 $params[$n] = $v;
7133 }
7134 }
7135 // handle simpleContent
7136 if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
7137 $this->debug('in buildVal, handling simpleContent');
7138 if (isset($this->message[$pos]['type'])) {
7139 $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
7140 } else {
7141 $parent = $this->message[$pos]['parent'];
7142 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
7143 $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
7144 } else {
7145 $params['!'] = $this->message[$pos]['cdata'];
7146 }
7147 }
7148 }
7149 $ret = is_array($params) ? $params : array();
7150 $this->debug('in buildVal, return:');
7151 $this->appendDebug($this->varDump($ret));
7152 return $ret;
7153 } else {
7154 $this->debug('in buildVal, no children, building scalar');
7155 $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
7156 if (isset($this->message[$pos]['type'])) {
7157 $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
7158 $this->debug("in buildVal, return: $ret");
7159 return $ret;
7160 }
7161 $parent = $this->message[$pos]['parent'];
7162 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
7163 $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
7164 $this->debug("in buildVal, return: $ret");
7165 return $ret;
7166 }
7167 $ret = $this->message[$pos]['cdata'];
7168 $this->debug("in buildVal, return: $ret");
7169 return $ret;
7170 }
7171 }
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
decodeSimple($value, $type, $typens)
decodes simple types into PHP variables
Definition: nusoap.php:7020
$c
Definition: cli.php:38
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33

References $c, $params, $parent, nusoap_base\appendDebug(), nusoap_base\debug(), decodeSimple(), and nusoap_base\varDump().

Referenced by __construct(), and end_element().

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

◆ character_data()

nusoap_parser::character_data (   $parser,
  $data 
)

element content handler

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

Definition at line 6946 of file nusoap.php.

6947 {
6948 $pos = $this->depth_array[$this->depth];
6949 if ($this->xml_encoding=='UTF-8') {
6950 // TODO: add an option to disable this for folks who want
6951 // raw UTF-8 that, e.g., might not map to iso-8859-1
6952 // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
6953 if ($this->decode_utf8) {
6954 $data = utf8_decode($data);
6955 }
6956 }
6957 $this->message[$pos]['cdata'] .= $data;
6958 // for doclit
6959 if ($this->status == 'header') {
6960 $this->responseHeaders .= $data;
6961 } else {
6962 $this->document .= $data;
6963 }
6964 }

References $data, and $depth.

◆ decodeSimple()

nusoap_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
Returns
mixed PHP value @access private

Definition at line 7020 of file nusoap.php.

7021 {
7022 // TODO: use the namespace!
7023 if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
7024 return (string) $value;
7025 }
7026 if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
7027 return (int) $value;
7028 }
7029 if ($type == 'float' || $type == 'double' || $type == 'decimal') {
7030 return (float) $value;
7031 }
7032 if ($type == 'boolean') {
7033 if (strtolower($value) == 'false' || strtolower($value) == 'f') {
7034 return false;
7035 }
7036 return (bool) $value;
7037 }
7038 if ($type == 'base64' || $type == 'base64Binary') {
7039 $this->debug('Decode base64 value');
7040 return base64_decode($value);
7041 }
7042 // obscure numeric types
7043 if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
7044 || $type == 'nonNegativeInteger' || $type == 'positiveInteger'
7045 || $type == 'unsignedInt'
7046 || $type == 'unsignedShort' || $type == 'unsignedByte') {
7047 return (int) $value;
7048 }
7049 // bogus: parser treats array with no elements as a simple type
7050 if ($type == 'array') {
7051 return array();
7052 }
7053 // everything else
7054 return (string) $value;
7055 }
$type

References $type, and nusoap_base\debug().

Referenced by buildVal(), and end_element().

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

◆ end_element()

nusoap_parser::end_element (   $parser,
  $name 
)

end-element handler

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

Definition at line 6841 of file nusoap.php.

6842 {
6843 // position of current element is equal to the last value left in depth_array for my depth
6844 $pos = $this->depth_array[$this->depth--];
6845
6846 // get element prefix
6847 if (strpos($name, ':')) {
6848 // get ns prefix
6849 $prefix = substr($name, 0, strpos($name, ':'));
6850 // get unqualified name
6851 $name = substr(strstr($name, ':'), 1);
6852 }
6853
6854 // build to native type
6855 if (isset($this->body_position) && $pos > $this->body_position) {
6856 // deal w/ multirefs
6857 if (isset($this->message[$pos]['attrs']['href'])) {
6858 // get id
6859 $id = substr($this->message[$pos]['attrs']['href'], 1);
6860 // add placeholder to href array
6861 $this->multirefs[$id][$pos] = 'placeholder';
6862 // add set a reference to it as the result value
6863 $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
6864 // build complexType values
6865 } elseif ($this->message[$pos]['children'] != '') {
6866 // if result has already been generated (struct/array)
6867 if (!isset($this->message[$pos]['result'])) {
6868 $this->message[$pos]['result'] = $this->buildVal($pos);
6869 }
6870 // build complexType values of attributes and possibly simpleContent
6871 } elseif (isset($this->message[$pos]['xattrs'])) {
6872 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
6873 $this->message[$pos]['xattrs']['!'] = null;
6874 } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
6875 if (isset($this->message[$pos]['type'])) {
6876 $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'] : '');
6877 } else {
6878 $parent = $this->message[$pos]['parent'];
6879 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
6880 $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
6881 } else {
6882 $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
6883 }
6884 }
6885 }
6886 $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
6887 // set value of simpleType (or nil complexType)
6888 } else {
6889 //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
6890 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
6891 $this->message[$pos]['xattrs']['!'] = null;
6892 } elseif (isset($this->message[$pos]['type'])) {
6893 $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'] : '');
6894 } else {
6895 $parent = $this->message[$pos]['parent'];
6896 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
6897 $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
6898 } else {
6899 $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
6900 }
6901 }
6902
6903 /* add value to parent's result, if parent is struct/array
6904 $parent = $this->message[$pos]['parent'];
6905 if($this->message[$parent]['type'] != 'map'){
6906 if(strtolower($this->message[$parent]['type']) == 'array'){
6907 $this->message[$parent]['result'][] = $this->message[$pos]['result'];
6908 } else {
6909 $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result'];
6910 }
6911 }
6912 */
6913 }
6914 }
6915
6916 // for doclit
6917 if ($this->status == 'header') {
6918 if ($this->root_header != $pos) {
6919 $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
6920 }
6921 } elseif ($pos >= $this->root_struct) {
6922 $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
6923 }
6924 // switch status
6925 if ($pos == $this->root_struct) {
6926 $this->status = 'body';
6927 $this->root_struct_namespace = $this->message[$pos]['namespace'];
6928 } elseif ($name == 'Body') {
6929 $this->status = 'envelope';
6930 } elseif ($name == 'Header') {
6931 $this->status = 'envelope';
6932 } elseif ($name == 'Envelope') {
6933 //
6934 }
6935 // set parent back to my parent
6936 $this->parent = $this->message[$pos]['parent'];
6937 }
if($format !==null) $name
Definition: metadata.php:247

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

+ Here is the call graph for this function:

◆ get_response()

nusoap_parser::get_response ( )

get the parsed message (SOAP Body)

Returns
mixed @access public
Deprecated:
use get_soapbody instead

Definition at line 6973 of file nusoap.php.

6974 {
6975 return $this->soapresponse;
6976 }

References $soapresponse.

◆ get_soapbody()

nusoap_parser::get_soapbody ( )

get the parsed SOAP Body (NULL if there was none)

Returns
mixed @access public

Definition at line 6984 of file nusoap.php.

6985 {
6986 return $this->soapresponse;
6987 }

References $soapresponse.

◆ get_soapheader()

nusoap_parser::get_soapheader ( )

get the parsed SOAP Header (NULL if there was none)

Returns
mixed @access public

Definition at line 6995 of file nusoap.php.

6996 {
6997 return $this->soapheader;
6998 }

References $soapheader.

◆ getHeaders()

nusoap_parser::getHeaders ( )

get the unparsed SOAP Header

Returns
string XML or empty if no Header @access public

Definition at line 7006 of file nusoap.php.

7007 {
7009 }

References $responseHeaders.

◆ start_element()

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

start-element handler

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

Definition at line 6685 of file nusoap.php.

6686 {
6687 // position in a total number of elements, starting from 0
6688 // update class level pos
6689 $pos = $this->position++;
6690 // and set mine
6691 $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
6692 // depth = how many levels removed from root?
6693 // set mine as current global depth and increment global depth value
6694 $this->message[$pos]['depth'] = $this->depth++;
6695
6696 // else add self as child to whoever the current parent is
6697 if ($pos != 0) {
6698 $this->message[$this->parent]['children'] .= '|' . $pos;
6699 }
6700 // set my parent
6701 $this->message[$pos]['parent'] = $this->parent;
6702 // set self as current parent
6703 $this->parent = $pos;
6704 // set self as current value for this depth
6705 $this->depth_array[$this->depth] = $pos;
6706 // get element prefix
6707 if (strpos($name, ':')) {
6708 // get ns prefix
6709 $prefix = substr($name, 0, strpos($name, ':'));
6710 // get unqualified name
6711 $name = substr(strstr($name, ':'), 1);
6712 }
6713 // set status
6714 if ($name == 'Envelope') {
6715 $this->status = 'envelope';
6716 } elseif ($name == 'Header' && $this->status = 'envelope') {
6717 $this->root_header = $pos;
6718 $this->status = 'header';
6719 } elseif ($name == 'Body' && $this->status = 'envelope') {
6720 $this->status = 'body';
6721 $this->body_position = $pos;
6722 // set method
6723 } elseif ($this->status == 'body' && $pos == ($this->body_position+1)) {
6724 $this->status = 'method';
6725 $this->root_struct_name = $name;
6726 $this->root_struct = $pos;
6727 $this->message[$pos]['type'] = 'struct';
6728 $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
6729 }
6730 // set my status
6731 $this->message[$pos]['status'] = $this->status;
6732 // set name
6733 $this->message[$pos]['name'] = htmlspecialchars($name);
6734 // set attrs
6735 $this->message[$pos]['attrs'] = $attrs;
6736
6737 // loop through atts, logging ns and type declarations
6738 $attstr = '';
6739 foreach ($attrs as $key => $value) {
6740 $key_prefix = $this->getPrefix($key);
6741 $key_localpart = $this->getLocalPart($key);
6742 // if ns declarations, add to class level array of valid namespaces
6743 if ($key_prefix == 'xmlns') {
6744 if (preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/', $value)) {
6745 $this->XMLSchemaVersion = $value;
6746 $this->namespaces['xsd'] = $this->XMLSchemaVersion;
6747 $this->namespaces['xsi'] = $this->XMLSchemaVersion . '-instance';
6748 }
6749 $this->namespaces[$key_localpart] = $value;
6750 // set method namespace
6751 if ($name == $this->root_struct_name) {
6752 $this->methodNamespace = $value;
6753 }
6754 // if it's a type declaration, set type
6755 } elseif ($key_localpart == 'type') {
6756 if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
6757 // do nothing: already processed arrayType
6758 } else {
6759 $value_prefix = $this->getPrefix($value);
6760 $value_localpart = $this->getLocalPart($value);
6761 $this->message[$pos]['type'] = $value_localpart;
6762 $this->message[$pos]['typePrefix'] = $value_prefix;
6763 if (isset($this->namespaces[$value_prefix])) {
6764 $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
6765 } elseif (isset($attrs['xmlns:' . $value_prefix])) {
6766 $this->message[$pos]['type_namespace'] = $attrs['xmlns:' . $value_prefix];
6767 }
6768 // should do something here with the namespace of specified type?
6769 }
6770 } elseif ($key_localpart == 'arrayType') {
6771 $this->message[$pos]['type'] = 'array';
6772 /* do arrayType ereg here
6773 [1] arrayTypeValue ::= atype asize
6774 [2] atype ::= QName rank*
6775 [3] rank ::= '[' (',')* ']'
6776 [4] asize ::= '[' length~ ']'
6777 [5] length ::= nextDimension* Digit+
6778 [6] nextDimension ::= Digit+ ','
6779 */
6780 $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
6781 if (preg_match($expr, $value, $regs)) {
6782 $this->message[$pos]['typePrefix'] = $regs[1];
6783 $this->message[$pos]['arrayTypePrefix'] = $regs[1];
6784 if (isset($this->namespaces[$regs[1]])) {
6785 $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
6786 } elseif (isset($attrs['xmlns:' . $regs[1]])) {
6787 $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:' . $regs[1]];
6788 }
6789 $this->message[$pos]['arrayType'] = $regs[2];
6790 $this->message[$pos]['arraySize'] = $regs[3];
6791 $this->message[$pos]['arrayCols'] = $regs[4];
6792 }
6793 // specifies nil value (or not)
6794 } elseif ($key_localpart == 'nil') {
6795 $this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
6796 // some other attribute
6797 } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
6798 $this->message[$pos]['xattrs']['!' . $key] = $value;
6799 }
6800
6801 if ($key == 'xmlns') {
6802 $this->default_namespace = $value;
6803 }
6804 // log id
6805 if ($key == 'id') {
6806 $this->ids[$value] = $pos;
6807 }
6808 // root
6809 if ($key_localpart == 'root' && $value == 1) {
6810 $this->status = 'method';
6811 $this->root_struct_name = $name;
6812 $this->root_struct = $pos;
6813 $this->debug("found root struct $this->root_struct_name, pos $pos");
6814 }
6815 // for doclit
6816 $attstr .= " $key=\"$value\"";
6817 }
6818 // get namespace - must be done after namespace atts are processed
6819 if (isset($prefix)) {
6820 $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
6821 $this->default_namespace = $this->namespaces[$prefix];
6822 } else {
6823 $this->message[$pos]['namespace'] = $this->default_namespace;
6824 }
6825 if ($this->status == 'header') {
6826 if ($this->root_header != $pos) {
6827 $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
6828 }
6829 } elseif ($this->root_struct_name != '') {
6830 $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
6831 }
6832 }
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:839
$XMLSchemaVersion
Definition: nusoap.php:155
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed
Definition: nusoap.php:821
string $key
Consumer key/client ID value.
Definition: System.php:193

References $default_namespace, $depth, ILIAS\LTI\ToolProvider\$key, $name, $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

nusoap_parser::$body_position = 0

Definition at line 6572 of file nusoap.php.

◆ $debug_flag

nusoap_parser::$debug_flag = true

Definition at line 6568 of file nusoap.php.

◆ $decode_utf8

nusoap_parser::$decode_utf8 = true

Definition at line 6579 of file nusoap.php.

Referenced by __construct().

◆ $default_namespace

nusoap_parser::$default_namespace = ''

Definition at line 6559 of file nusoap.php.

Referenced by start_element().

◆ $depth

nusoap_parser::$depth = 0

Definition at line 6558 of file nusoap.php.

Referenced by character_data(), and start_element().

◆ $depth_array

nusoap_parser::$depth_array = array()

Definition at line 6567 of file nusoap.php.

◆ $document

nusoap_parser::$document = ''

Definition at line 6554 of file nusoap.php.

◆ $fault

nusoap_parser::$fault = false

Definition at line 6563 of file nusoap.php.

◆ $fault_code

nusoap_parser::$fault_code = ''

Definition at line 6564 of file nusoap.php.

◆ $fault_detail

nusoap_parser::$fault_detail = ''

Definition at line 6566 of file nusoap.php.

◆ $fault_str

nusoap_parser::$fault_str = ''

Definition at line 6565 of file nusoap.php.

◆ $ids

nusoap_parser::$ids = array()

Definition at line 6575 of file nusoap.php.

◆ $message

nusoap_parser::$message = array()

Definition at line 6561 of file nusoap.php.

◆ $method

nusoap_parser::$method = ''

Definition at line 6549 of file nusoap.php.

Referenced by __construct().

◆ $multirefs

nusoap_parser::$multirefs = array()

Definition at line 6577 of file nusoap.php.

◆ $namespaces

nusoap_parser::$namespaces = array()

Definition at line 6560 of file nusoap.php.

◆ $parent

nusoap_parser::$parent = ''

Definition at line 6562 of file nusoap.php.

Referenced by buildVal(), end_element(), and start_element().

◆ $position

nusoap_parser::$position = 0

Definition at line 6557 of file nusoap.php.

◆ $responseHeaders

nusoap_parser::$responseHeaders = ''

Definition at line 6571 of file nusoap.php.

Referenced by getHeaders().

◆ $root_header

nusoap_parser::$root_header = ''

Definition at line 6553 of file nusoap.php.

Referenced by __construct().

◆ $root_struct

nusoap_parser::$root_struct = ''

Definition at line 6550 of file nusoap.php.

Referenced by __construct().

◆ $root_struct_name

nusoap_parser::$root_struct_name = ''

Definition at line 6551 of file nusoap.php.

◆ $root_struct_namespace

nusoap_parser::$root_struct_namespace = ''

Definition at line 6552 of file nusoap.php.

◆ $soapheader

nusoap_parser::$soapheader = null

Definition at line 6570 of file nusoap.php.

Referenced by get_soapheader().

◆ $soapresponse

nusoap_parser::$soapresponse = null

Definition at line 6569 of file nusoap.php.

Referenced by get_response(), and get_soapbody().

◆ $status

nusoap_parser::$status = ''

Definition at line 6556 of file nusoap.php.

Referenced by start_element().

◆ $xml

nusoap_parser::$xml = ''

Definition at line 6547 of file nusoap.php.

Referenced by __construct().

◆ $xml_encoding

nusoap_parser::$xml_encoding = ''

Definition at line 6548 of file nusoap.php.

Referenced by __construct().


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