ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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

 $methodNamespace
 
 $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
 
- 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 6513 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 6560 of file nusoap.php.

6561 {
6563 $this->xml = $xml;
6564 $this->xml_encoding = $encoding;
6565 $this->method = $method;
6566 $this->decode_utf8 = $decode_utf8;
6567
6568 // Check whether content has been read.
6569 if (!empty($xml)) {
6570 // Check XML encoding
6571 $pos_xml = strpos($xml, '<?xml');
6572 if ($pos_xml !== false) {
6573 $xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
6574 if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
6575 $xml_encoding = $res[1];
6576 if (strtoupper($xml_encoding) != $encoding) {
6577 $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
6578 $this->debug($err);
6579 if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
6580 $this->setError($err);
6581 return;
6582 }
6583 // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
6584 } else {
6585 $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
6586 }
6587 } else {
6588 $this->debug('No encoding specified in XML declaration');
6589 }
6590 } else {
6591 $this->debug('No XML declaration');
6592 }
6593 $this->debug('Entering nusoap_parser(), length=' . strlen($xml) . ', encoding=' . $encoding);
6594 // Create an XML parser - why not xml_parser_create_ns?
6595 $this->parser = xml_parser_create($this->xml_encoding);
6596 // Set the options for parsing the XML data.
6597 //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
6598 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
6599 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
6600 // Set the object for the parser.
6601 // Set the element handlers for the parser.
6602 xml_set_element_handler($this->parser, $this->start_element(...), $this->end_element(...));
6603 xml_set_character_data_handler($this->parser, $this->character_data(...));
6604
6605 // Parse the XML file.
6606 if (!xml_parse($this->parser, $xml, true)) {
6607 // Display an error message.
6608 $err = sprintf(
6609 'XML error parsing SOAP payload on line %d: %s',
6610 xml_get_current_line_number($this->parser),
6611 xml_error_string(xml_get_error_code($this->parser))
6612 );
6613 $this->debug($err);
6614 $this->debug("XML payload:\n" . $xml);
6615 $this->setError($err);
6616 } else {
6617 $this->debug('parsed successfully, found root struct: ' . $this->root_struct . ' of name ' . $this->root_struct_name);
6618 // get final value
6619 $this->soapresponse = $this->message[$this->root_struct]['result'];
6620 // get header value
6621 if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) {
6622 $this->soapheader = $this->message[$this->root_header]['result'];
6623 }
6624 // resolve hrefs/ids
6625 if (sizeof($this->multirefs) > 0) {
6626 foreach ($this->multirefs as $id => $hrefs) {
6627 $this->debug('resolving multirefs for id: ' . $id);
6628 $idVal = $this->buildVal($this->ids[$id]);
6629 if (is_array($idVal) && isset($idVal['!id'])) {
6630 unset($idVal['!id']);
6631 }
6632 foreach ($hrefs as $refPos => $ref) {
6633 $this->debug('resolving href at pos ' . $refPos);
6634 $this->multirefs[$id][$refPos] = $idVal;
6635 }
6636 }
6637 }
6638 }
6639 } else {
6640 $this->debug('xml was empty, didn\'t parse!');
6641 $this->setError('xml was empty, didn\'t parse!');
6642 }
6643 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setError($str)
sets error string
Definition: nusoap.php:353
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
character_data($parser, $data)
element content handler
Definition: nusoap.php:6914
end_element($parser, $name)
end-element handler
Definition: nusoap.php:6809
start_element($parser, $name, $attrs)
start-element handler
Definition: nusoap.php:6653
buildVal($pos)
builds response structures for compound values (arrays/structs) and scalars
Definition: nusoap.php:7033
$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(), character_data(), nusoap_base\debug(), end_element(), nusoap_base\setError(), and start_element().

+ 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 7033 of file nusoap.php.

7034 {
7035 if (!isset($this->message[$pos]['type'])) {
7036 $this->message[$pos]['type'] = '';
7037 }
7038 $this->debug('in buildVal() for ' . $this->message[$pos]['name'] . "(pos $pos) of type " . $this->message[$pos]['type']);
7039 // if there are children...
7040 if ($this->message[$pos]['children'] != '') {
7041 $this->debug('in buildVal, there are children');
7042 $children = explode('|', $this->message[$pos]['children']);
7043 array_shift($children); // knock off empty
7044 // md array
7045 if (isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != '') {
7046 $r = 0; // rowcount
7047 $c = 0; // colcount
7048 foreach ($children as $child_pos) {
7049 $this->debug("in buildVal, got an MD array element: $r, $c");
7050 $params[$r][] = $this->message[$child_pos]['result'];
7051 $c++;
7052 if ($c == $this->message[$pos]['arrayCols']) {
7053 $c = 0;
7054 $r++;
7055 }
7056 }
7057 // array
7058 } elseif ($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array') {
7059 $this->debug('in buildVal, adding array ' . $this->message[$pos]['name']);
7060 foreach ($children as $child_pos) {
7061 $params[] = &$this->message[$child_pos]['result'];
7062 }
7063 // apache Map type: java hashtable
7064 } elseif ($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
7065 $this->debug('in buildVal, Java Map ' . $this->message[$pos]['name']);
7066 foreach ($children as $child_pos) {
7067 $kv = explode("|", $this->message[$child_pos]['children']);
7068 $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
7069 }
7070 // generic compound type
7071 //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
7072 } else {
7073 // Apache Vector type: treat as an array
7074 $this->debug('in buildVal, adding Java Vector or generic compound type ' . $this->message[$pos]['name']);
7075 if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
7076 $notstruct = 1;
7077 } else {
7078 $notstruct = 0;
7079 }
7080 //
7081 foreach ($children as $child_pos) {
7082 if ($notstruct) {
7083 $params[] = &$this->message[$child_pos]['result'];
7084 } else {
7085 if (isset($params[$this->message[$child_pos]['name']])) {
7086 // de-serialize repeated element name into an array
7087 if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
7088 $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
7089 }
7090 $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
7091 } else {
7092 $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
7093 }
7094 }
7095 }
7096 }
7097 if (isset($this->message[$pos]['xattrs'])) {
7098 $this->debug('in buildVal, handling attributes');
7099 foreach ($this->message[$pos]['xattrs'] as $n => $v) {
7100 $params[$n] = $v;
7101 }
7102 }
7103 // handle simpleContent
7104 if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
7105 $this->debug('in buildVal, handling simpleContent');
7106 if (isset($this->message[$pos]['type'])) {
7107 $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
7108 } else {
7109 $parent = $this->message[$pos]['parent'];
7110 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
7111 $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
7112 } else {
7113 $params['!'] = $this->message[$pos]['cdata'];
7114 }
7115 }
7116 }
7117 $ret = is_array($params) ? $params : array();
7118 $this->debug('in buildVal, return:');
7119 $this->appendDebug($this->varDump($ret));
7120 return $ret;
7121 } else {
7122 $this->debug('in buildVal, no children, building scalar');
7123 $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
7124 if (isset($this->message[$pos]['type'])) {
7125 $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
7126 $this->debug("in buildVal, return: $ret");
7127 return $ret;
7128 }
7129 $parent = $this->message[$pos]['parent'];
7130 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
7131 $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
7132 $this->debug("in buildVal, return: $ret");
7133 return $ret;
7134 }
7135 $ret = $this->message[$pos]['cdata'];
7136 $this->debug("in buildVal, return: $ret");
7137 return $ret;
7138 }
7139 }
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
decodeSimple($value, $type, $typens)
decodes simple types into PHP variables
Definition: nusoap.php:6988
$c
Definition: deliver.php:25
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31

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 6914 of file nusoap.php.

6915 {
6916 $pos = $this->depth_array[$this->depth];
6917 if ($this->xml_encoding == 'UTF-8') {
6918 // TODO: add an option to disable this for folks who want
6919 // raw UTF-8 that, e.g., might not map to iso-8859-1
6920 // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
6921 if ($this->decode_utf8) {
6922 $data = utf8_decode($data);
6923 }
6924 }
6925 $this->message[$pos]['cdata'] .= $data;
6926 // for doclit
6927 if ($this->status == 'header') {
6928 $this->responseHeaders .= $data;
6929 } else {
6930 $this->document .= $data;
6931 }
6932 }

References $data, and $depth.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ 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 6988 of file nusoap.php.

6989 {
6990 // TODO: use the namespace!
6991 if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
6992 return (string) $value;
6993 }
6994 if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
6995 return (int) $value;
6996 }
6997 if ($type == 'float' || $type == 'double' || $type == 'decimal') {
6998 return (float) $value;
6999 }
7000 if ($type == 'boolean') {
7001 if (strtolower($value) == 'false' || strtolower($value) == 'f') {
7002 return false;
7003 }
7004 return (bool) $value;
7005 }
7006 if ($type == 'base64' || $type == 'base64Binary') {
7007 $this->debug('Decode base64 value');
7008 return base64_decode($value);
7009 }
7010 // obscure numeric types
7011 if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
7012 || $type == 'nonNegativeInteger' || $type == 'positiveInteger'
7013 || $type == 'unsignedInt'
7014 || $type == 'unsignedShort' || $type == 'unsignedByte') {
7015 return (int) $value;
7016 }
7017 // bogus: parser treats array with no elements as a simple type
7018 if ($type == 'array') {
7019 return array();
7020 }
7021 // everything else
7022 return (string) $value;
7023 }

References 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 6809 of file nusoap.php.

6810 {
6811 // position of current element is equal to the last value left in depth_array for my depth
6812 $pos = $this->depth_array[$this->depth--];
6813
6814 // get element prefix
6815 if (strpos($name, ':')) {
6816 // get ns prefix
6817 $prefix = substr($name, 0, strpos($name, ':'));
6818 // get unqualified name
6819 $name = substr(strstr($name, ':'), 1);
6820 }
6821
6822 // build to native type
6823 if (isset($this->body_position) && $pos > $this->body_position) {
6824 // deal w/ multirefs
6825 if (isset($this->message[$pos]['attrs']['href'])) {
6826 // get id
6827 $id = substr($this->message[$pos]['attrs']['href'], 1);
6828 // add placeholder to href array
6829 $this->multirefs[$id][$pos] = 'placeholder';
6830 // add set a reference to it as the result value
6831 $this->message[$pos]['result'] = & $this->multirefs[$id][$pos];
6832 // build complexType values
6833 } elseif ($this->message[$pos]['children'] != '') {
6834 // if result has already been generated (struct/array)
6835 if (!isset($this->message[$pos]['result'])) {
6836 $this->message[$pos]['result'] = $this->buildVal($pos);
6837 }
6838 // build complexType values of attributes and possibly simpleContent
6839 } elseif (isset($this->message[$pos]['xattrs'])) {
6840 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
6841 $this->message[$pos]['xattrs']['!'] = null;
6842 } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
6843 if (isset($this->message[$pos]['type'])) {
6844 $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'] : '');
6845 } else {
6846 $parent = $this->message[$pos]['parent'];
6847 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
6848 $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
6849 } else {
6850 $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
6851 }
6852 }
6853 }
6854 $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
6855 // set value of simpleType (or nil complexType)
6856 } else {
6857 //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
6858 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
6859 $this->message[$pos]['xattrs']['!'] = null;
6860 } elseif (isset($this->message[$pos]['type'])) {
6861 $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'] : '');
6862 } else {
6863 $parent = $this->message[$pos]['parent'];
6864 if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
6865 $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
6866 } else {
6867 $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
6868 }
6869 }
6870
6871 /* add value to parent's result, if parent is struct/array
6872 $parent = $this->message[$pos]['parent'];
6873 if($this->message[$parent]['type'] != 'map'){
6874 if(strtolower($this->message[$parent]['type']) == 'array'){
6875 $this->message[$parent]['result'][] = $this->message[$pos]['result'];
6876 } else {
6877 $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result'];
6878 }
6879 }
6880 */
6881 }
6882 }
6883
6884 // for doclit
6885 if ($this->status == 'header') {
6886 if ($this->root_header != $pos) {
6887 $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
6888 }
6889 } elseif ($pos >= $this->root_struct) {
6890 $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
6891 }
6892 // switch status
6893 if ($pos == $this->root_struct) {
6894 $this->status = 'body';
6895 $this->root_struct_namespace = $this->message[$pos]['namespace'];
6896 } elseif ($name == 'Body') {
6897 $this->status = 'envelope';
6898 } elseif ($name == 'Header') {
6899 $this->status = 'envelope';
6900 } elseif ($name == 'Envelope') {
6901 //
6902 }
6903 // set parent back to my parent
6904 $this->parent = $this->message[$pos]['parent'];
6905 }

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller 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 6941 of file nusoap.php.

6942 {
6943 return $this->soapresponse;
6944 }

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 6952 of file nusoap.php.

6953 {
6954 return $this->soapresponse;
6955 }

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 6963 of file nusoap.php.

6964 {
6965 return $this->soapheader;
6966 }

References $soapheader.

◆ getHeaders()

nusoap_parser::getHeaders ( )

get the unparsed SOAP Header

Returns
string XML or empty if no Header @access public

Definition at line 6974 of file nusoap.php.

6975 {
6977 }

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 6653 of file nusoap.php.

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

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

Referenced by __construct().

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

Field Documentation

◆ $body_position

nusoap_parser::$body_position = 0

Definition at line 6542 of file nusoap.php.

◆ $debug_flag

nusoap_parser::$debug_flag = true

Definition at line 6538 of file nusoap.php.

◆ $decode_utf8

nusoap_parser::$decode_utf8 = true

Definition at line 6549 of file nusoap.php.

Referenced by __construct().

◆ $default_namespace

nusoap_parser::$default_namespace = ''

Definition at line 6529 of file nusoap.php.

Referenced by start_element().

◆ $depth

nusoap_parser::$depth = 0

Definition at line 6528 of file nusoap.php.

Referenced by character_data(), and start_element().

◆ $depth_array

nusoap_parser::$depth_array = array()

Definition at line 6537 of file nusoap.php.

◆ $document

nusoap_parser::$document = ''

Definition at line 6524 of file nusoap.php.

◆ $fault

nusoap_parser::$fault = false

Definition at line 6533 of file nusoap.php.

◆ $fault_code

nusoap_parser::$fault_code = ''

Definition at line 6534 of file nusoap.php.

◆ $fault_detail

nusoap_parser::$fault_detail = ''

Definition at line 6536 of file nusoap.php.

◆ $fault_str

nusoap_parser::$fault_str = ''

Definition at line 6535 of file nusoap.php.

◆ $ids

nusoap_parser::$ids = array()

Definition at line 6545 of file nusoap.php.

◆ $message

nusoap_parser::$message = array()

Definition at line 6531 of file nusoap.php.

◆ $method

nusoap_parser::$method = ''

Definition at line 6519 of file nusoap.php.

Referenced by __construct().

◆ $methodNamespace

nusoap_parser::$methodNamespace

Definition at line 6515 of file nusoap.php.

◆ $multirefs

nusoap_parser::$multirefs = array()

Definition at line 6547 of file nusoap.php.

◆ $namespaces

nusoap_parser::$namespaces = array()

Definition at line 6530 of file nusoap.php.

◆ $parent

nusoap_parser::$parent = ''

Definition at line 6532 of file nusoap.php.

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

◆ $parser

nusoap_parser::$parser

Definition at line 6516 of file nusoap.php.

◆ $position

nusoap_parser::$position = 0

Definition at line 6527 of file nusoap.php.

◆ $responseHeaders

nusoap_parser::$responseHeaders = ''

Definition at line 6541 of file nusoap.php.

Referenced by getHeaders().

◆ $root_header

nusoap_parser::$root_header = ''

Definition at line 6523 of file nusoap.php.

Referenced by __construct().

◆ $root_struct

nusoap_parser::$root_struct = ''

Definition at line 6520 of file nusoap.php.

Referenced by __construct().

◆ $root_struct_name

nusoap_parser::$root_struct_name = ''

Definition at line 6521 of file nusoap.php.

◆ $root_struct_namespace

nusoap_parser::$root_struct_namespace = ''

Definition at line 6522 of file nusoap.php.

◆ $soapheader

nusoap_parser::$soapheader = null

Definition at line 6540 of file nusoap.php.

Referenced by get_soapheader().

◆ $soapresponse

nusoap_parser::$soapresponse = null

Definition at line 6539 of file nusoap.php.

Referenced by get_response(), and get_soapbody().

◆ $status

nusoap_parser::$status = ''

Definition at line 6526 of file nusoap.php.

Referenced by start_element().

◆ $xml

nusoap_parser::$xml = ''

Definition at line 6517 of file nusoap.php.

Referenced by __construct().

◆ $xml_encoding

nusoap_parser::$xml_encoding = ''

Definition at line 6518 of file nusoap.php.

Referenced by __construct().


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