ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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$ public

Definition at line 6543 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 public

Definition at line 6588 of file nusoap.php.

References $id, $res, ILIAS\MetaData\Repository\Validation\Data\__construct(), nusoap_base\debug(), and nusoap_base\setError().

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

Definition at line 7063 of file nusoap.php.

References Vendor\Package\$c, $params, $r, nusoap_base\appendDebug(), nusoap_base\debug(), and nusoap_base\varDump().

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

◆ character_data()

nusoap_parser::character_data (   $parser,
  $data 
)

element content handler

Parameters
resource$parserXML parser object
string$dataelement content private

Definition at line 6944 of file nusoap.php.

References $data.

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

◆ 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 private

Definition at line 7018 of file nusoap.php.

References nusoap_base\debug().

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

◆ end_element()

nusoap_parser::end_element (   $parser,
  $name 
)

end-element handler

Parameters
resource$parserXML parser object
string$nameelement name private

Definition at line 6839 of file nusoap.php.

References $id.

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

◆ get_response()

nusoap_parser::get_response ( )

get the parsed message (SOAP Body)

Returns
mixed public
Deprecated:
use get_soapbody instead

Definition at line 6971 of file nusoap.php.

6972  {
6973  return $this->soapresponse;
6974  }

◆ get_soapbody()

nusoap_parser::get_soapbody ( )

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

Returns
mixed public

Definition at line 6982 of file nusoap.php.

6983  {
6984  return $this->soapresponse;
6985  }

◆ get_soapheader()

nusoap_parser::get_soapheader ( )

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

Returns
mixed public

Definition at line 6993 of file nusoap.php.

6994  {
6995  return $this->soapheader;
6996  }

◆ getHeaders()

nusoap_parser::getHeaders ( )

get the unparsed SOAP Header

Returns
string XML or empty if no Header public

Definition at line 7004 of file nusoap.php.

7005  {
7006  return $this->responseHeaders;
7007  }

◆ 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 private

Definition at line 6683 of file nusoap.php.

References ILIAS\LTI\ToolProvider\$key, nusoap_base\$XMLSchemaVersion, nusoap_base\debug(), nusoap_base\getLocalPart(), and nusoap_base\getPrefix().

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

Field Documentation

◆ $body_position

nusoap_parser::$body_position = 0

Definition at line 6570 of file nusoap.php.

◆ $debug_flag

nusoap_parser::$debug_flag = true

Definition at line 6566 of file nusoap.php.

◆ $decode_utf8

nusoap_parser::$decode_utf8 = true

Definition at line 6577 of file nusoap.php.

◆ $default_namespace

nusoap_parser::$default_namespace = ''

Definition at line 6557 of file nusoap.php.

◆ $depth

nusoap_parser::$depth = 0

Definition at line 6556 of file nusoap.php.

◆ $depth_array

nusoap_parser::$depth_array = array()

Definition at line 6565 of file nusoap.php.

◆ $document

nusoap_parser::$document = ''

Definition at line 6552 of file nusoap.php.

◆ $fault

nusoap_parser::$fault = false

Definition at line 6561 of file nusoap.php.

◆ $fault_code

nusoap_parser::$fault_code = ''

Definition at line 6562 of file nusoap.php.

◆ $fault_detail

nusoap_parser::$fault_detail = ''

Definition at line 6564 of file nusoap.php.

◆ $fault_str

nusoap_parser::$fault_str = ''

Definition at line 6563 of file nusoap.php.

◆ $ids

nusoap_parser::$ids = array()

Definition at line 6573 of file nusoap.php.

◆ $message

nusoap_parser::$message = array()

Definition at line 6559 of file nusoap.php.

◆ $method

nusoap_parser::$method = ''

Definition at line 6547 of file nusoap.php.

◆ $multirefs

nusoap_parser::$multirefs = array()

Definition at line 6575 of file nusoap.php.

◆ $namespaces

nusoap_parser::$namespaces = array()

Definition at line 6558 of file nusoap.php.

◆ $parent

nusoap_parser::$parent = ''

Definition at line 6560 of file nusoap.php.

◆ $position

nusoap_parser::$position = 0

Definition at line 6555 of file nusoap.php.

◆ $responseHeaders

nusoap_parser::$responseHeaders = ''

Definition at line 6569 of file nusoap.php.

◆ $root_header

nusoap_parser::$root_header = ''

Definition at line 6551 of file nusoap.php.

◆ $root_struct

nusoap_parser::$root_struct = ''

Definition at line 6548 of file nusoap.php.

◆ $root_struct_name

nusoap_parser::$root_struct_name = ''

Definition at line 6549 of file nusoap.php.

◆ $root_struct_namespace

nusoap_parser::$root_struct_namespace = ''

Definition at line 6550 of file nusoap.php.

◆ $soapheader

nusoap_parser::$soapheader = null

Definition at line 6568 of file nusoap.php.

◆ $soapresponse

nusoap_parser::$soapresponse = null

Definition at line 6567 of file nusoap.php.

◆ $status

nusoap_parser::$status = ''

Definition at line 6554 of file nusoap.php.

◆ $xml

nusoap_parser::$xml = ''

Definition at line 6545 of file nusoap.php.

◆ $xml_encoding

nusoap_parser::$xml_encoding = ''

Definition at line 6546 of file nusoap.php.


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