ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
nusoap_base Class Reference

nusoap_base More...

+ Inheritance diagram for nusoap_base:
+ Collaboration diagram for nusoap_base:

Public Member Functions

 debug ($string)
 adds debug data to the class level debug string More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
 serialize message More...
 
 formatDump ($str)
 
 contractQname ($qname)
 contracts a qualified name More...
 
 expandQname ($qname)
 expands a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace returns false if no namespace registered with the given prefix More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 varDump ($data)
 
 __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

 $title = 'NuSOAP'
 
 $version = '0.6.7'
 
 $revision = '$Revision$'
 
 $error_str = false
 
 $debug_str = ''
 
 $charencoding = true
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 
 $debugLevel
 

Detailed Description

nusoap_base

Author
Dietrich Ayala dietr.nosp@m.ich@.nosp@m.ganx4.nosp@m..com
Version
$Id$ public
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 61 of file nusoap.php.

Constructor & Destructor Documentation

◆ __construct()

nusoap_base::__construct ( )

constructor

public

Definition at line 236 of file nusoap.php.

References $GLOBALS.

236  {
237  $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
238  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

Member Function Documentation

◆ __toString()

nusoap_base::__toString ( )

represents the object as a string

Returns
string public

Definition at line 898 of file nusoap.php.

References varDump().

898  {
899  return $this->varDump($this);
900  }
varDump($data)
Definition: nusoap.php:567
+ Here is the call graph for this function:

◆ appendDebug()

◆ clearDebug()

nusoap_base::clearDebug ( )

clears the current debug data for this instance

public

Definition at line 311 of file nusoap.php.

Referenced by nusoap_server\__construct(), nusoap_client\call(), nusoap_client\checkWSDL(), and nusoap_server\serialize_return().

311  {
312  // it would be nice to use a memory stream here to use
313  // memory more efficiently
314  $this->debug_str = '';
315  }
+ Here is the caller graph for this function:

◆ contractQname() [1/2]

nusoap_base::contractQname (   $qname)

contracts a qualified name

Parameters
string$stringqname
Returns
string contracted qname private

Definition at line 458 of file nusoap.php.

References $name, and getPrefixFromNamespace().

458  {
459  // get element namespace
460  //$this->xdebug("Contract $qname");
461  if (strrpos($qname, ':')) {
462  // get unqualified name
463  $name = substr($qname, strrpos($qname, ':') + 1);
464  // get ns
465  $ns = substr($qname, 0, strrpos($qname, ':'));
466  $p = $this->getPrefixFromNamespace($ns);
467  if ($p) {
468  return $p . ':' . $name;
469  }
470  return $qname;
471  } else {
472  return $qname;
473  }
474  }
if($format !==null) $name
Definition: metadata.php:230
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:557
+ Here is the call graph for this function:

◆ contractQname() [2/2]

nusoap_base::contractQname (   $qname)

contracts (changes namespace to prefix) a qualified name

Parameters
string$qnameqname
Returns
string contracted qname private

Definition at line 751 of file nusoap.php.

References $name, and getPrefixFromNamespace().

751  {
752  // get element namespace
753  //$this->xdebug("Contract $qname");
754  if (strrpos($qname, ':')) {
755  // get unqualified name
756  $name = substr($qname, strrpos($qname, ':') + 1);
757  // get ns
758  $ns = substr($qname, 0, strrpos($qname, ':'));
759  $p = $this->getPrefixFromNamespace($ns);
760  if ($p) {
761  return $p . ':' . $name;
762  }
763  return $qname;
764  } else {
765  return $qname;
766  }
767  }
if($format !==null) $name
Definition: metadata.php:230
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:557
+ Here is the call graph for this function:

◆ debug() [1/2]

nusoap_base::debug (   $string)

adds debug data to the class level debug string

Parameters
string$stringdebug data private

Definition at line 144 of file nusoap.php.

Referenced by nusoap_xmlschema\__construct(), soap_transport_http\__construct(), nusoap_server\__construct(), wsdl\__construct(), nusoap_parser\__construct(), nusoap_client\__construct(), nusoap_client\_getProxyClassCode(), soap_transport_http\buildPayload(), soap_parser\buildVal(), nusoap_parser\buildVal(), soap_client\call(), nusoap_client\call(), nusoap_client\checkCookies(), nusoap_client\checkWSDL(), soap_transport_http\connect(), soap_transport_http\decodeChunked(), nusoap_parser\decodeSimple(), wsdl\end_element(), wsdl\fetchWSDL(), soap_transport_http\getCookiesForRequest(), soap_client\getOperationData(), nusoap_client\getOperationData(), nusoap_client\getProxy(), soap_transport_http\getResponse(), wsdl\getTypeDef(), soap_server\invoke_method(), nusoap_server\invoke_method(), nusoap_client\loadWSDL(), wsdl\parametersMatchWrapped(), soap_server\parse_http_headers(), nusoap_server\parse_http_headers(), soap_server\parse_request(), nusoap_server\parse_request(), XMLSchema\parseFile(), nusoap_xmlschema\parseFile(), nusoap_server\parseRequest(), soap_client\parseResponse(), nusoap_client\parseResponse(), XMLSchema\parseString(), nusoap_xmlschema\parseString(), wsdl\parseWSDL(), soap_transport_http\send(), soap_client\send(), nusoap_client\send(), soap_server\send_response(), nusoap_server\send_response(), soap_transport_http\sendRequest(), soap_server\serialize_return(), nusoap_server\serialize_return(), serialize_val(), wsdl\serializeComplexTypeAttributes(), wsdl\serializeComplexTypeElements(), serializeEnvelope(), wsdl\serializeParameters(), wsdl\serializeRPCParameters(), wsdl\serializeType(), nusoap_server\service(), soap_transport_http\setCredentials(), wsdl\setCredentials(), nusoap_client\setCredentials(), soap_transport_http\setCurlOption(), nusoap_client\setCurlOption(), nusoap_client\setEndpoint(), soap_transport_http\setHeader(), nusoap_client\setHeaders(), nusoap_client\setHTTPEncoding(), soap_transport_http\setProxy(), soap_transport_http\setURL(), nusoap_client\setUseCURL(), soap_client\soap_client(), soap_parser\soap_parser(), soap_server\soap_server(), soap_transport_http\soap_transport_http(), wsdl\start_element(), soap_parser\start_element(), nusoap_parser\start_element(), soap_transport_http\unsetHeader(), nusoap_client\UpdateCookies(), nusoap_client\useHTTPPersistentConnection(), wsdl\wsdl(), XMLSchema\xdebug(), nusoap_xmlschema\xdebug(), and XMLSchema\XMLSchema().

144  {
145  $this->debug_str .= get_class($this).": $string\n";
146  }
+ Here is the caller graph for this function:

◆ debug() [2/2]

nusoap_base::debug (   $string)

adds debug data to the instance debug string with formatting

Parameters
string$stringdebug data private

Definition at line 286 of file nusoap.php.

References appendDebug(), and getmicrotime().

286  {
287  if ($this->debugLevel > 0) {
288  $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
289  }
290  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:298
getmicrotime()
returns the time in ODBC canonical form with microseconds
Definition: nusoap.php:865
+ Here is the call graph for this function:

◆ expandEntities() [1/2]

nusoap_base::expandEntities (   $val)

expands entities, e.g.

changes '<' to '<'.

Parameters
string$valThe string in which to expand entities. private

Definition at line 154 of file nusoap.php.

Referenced by serialize_val(), wsdl\serializeComplexTypeAttributes(), and wsdl\serializeType().

154  {
155  if ($this->charencoding) {
156  $val = str_replace('&', '&amp;', $val);
157  $val = str_replace("'", '&apos;', $val);
158  $val = str_replace('"', '&quot;', $val);
159  $val = str_replace('<', '&lt;', $val);
160  $val = str_replace('>', '&gt;', $val);
161  }
162  return $val;
163  }
+ Here is the caller graph for this function:

◆ expandEntities() [2/2]

nusoap_base::expandEntities (   $val)

expands entities, e.g.

changes '<' to '<'.

Parameters
string$valThe string in which to expand entities. private

Definition at line 352 of file nusoap.php.

352  {
353  if ($this->charencoding) {
354  $val = str_replace('&', '&amp;', $val);
355  $val = str_replace("'", '&apos;', $val);
356  $val = str_replace('"', '&quot;', $val);
357  $val = str_replace('<', '&lt;', $val);
358  $val = str_replace('>', '&gt;', $val);
359  }
360  return $val;
361  }

◆ expandQname() [1/2]

nusoap_base::expandQname (   $qname)

expands a qualified name

Parameters
string$stringqname
Returns
string expanded qname private

Definition at line 483 of file nusoap.php.

References $name.

Referenced by wsdl\addComplexType(), wsdl\addSimpleType(), XMLSchema\schemaStartElement(), nusoap_xmlschema\schemaStartElement(), and wsdl\start_element().

483  {
484  // get element prefix
485  if(strpos($qname,':') && !ereg('^http://',$qname)){
486  // get unqualified name
487  $name = substr(strstr($qname,':'),1);
488  // get ns prefix
489  $prefix = substr($qname,0,strpos($qname,':'));
490  if(isset($this->namespaces[$prefix])){
491  return $this->namespaces[$prefix].':'.$name;
492  } else {
493  return $qname;
494  }
495  } else {
496  return $qname;
497  }
498  }
if($format !==null) $name
Definition: metadata.php:230
+ Here is the caller graph for this function:

◆ expandQname() [2/2]

nusoap_base::expandQname (   $qname)

expands (changes prefix to namespace) a qualified name

Parameters
string$qnameqname
Returns
string expanded qname private

Definition at line 776 of file nusoap.php.

References $name.

776  {
777  // get element prefix
778  if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
779  // get unqualified name
780  $name = substr(strstr($qname,':'),1);
781  // get ns prefix
782  $prefix = substr($qname,0,strpos($qname,':'));
783  if(isset($this->namespaces[$prefix])){
784  return $this->namespaces[$prefix].':'.$name;
785  } else {
786  return $qname;
787  }
788  } else {
789  return $qname;
790  }
791  }
if($format !==null) $name
Definition: metadata.php:230

◆ formatDump() [1/2]

nusoap_base::formatDump (   $str)

Definition at line 446 of file nusoap.php.

446  {
447  $str = htmlspecialchars($str);
448  return nl2br($str);
449  }

◆ formatDump() [2/2]

nusoap_base::formatDump (   $str)

formats a string to be inserted into an HTML stream

Parameters
string$strThe string to format
Returns
string The formatted string public
Deprecated:

Definition at line 739 of file nusoap.php.

739  {
740  $str = htmlspecialchars($str);
741  return nl2br($str);
742  }

◆ getDebug()

& nusoap_base::getDebug ( )

gets the current debug data for this instance

Returns
debug data public

Definition at line 323 of file nusoap.php.

References $debug_str.

Referenced by nusoap_server\__construct(), nusoap_client\call(), nusoap_client\checkWSDL(), nusoap_server\fault(), and nusoap_server\serialize_return().

323  {
324  // it would be nice to use a memory stream here to use
325  // memory more efficiently
326  return $this->debug_str;
327  }
+ Here is the caller graph for this function:

◆ getDebugAsXMLComment()

& nusoap_base::getDebugAsXMLComment ( )

gets the current debug data for this instance as an XML comment this may change the contents of the debug data

Returns
debug data as an XML comment public

Definition at line 336 of file nusoap.php.

References $ret.

Referenced by nusoap_server\send_response(), and nusoap_server\service().

336  {
337  // it would be nice to use a memory stream here to use
338  // memory more efficiently
339  while (strpos($this->debug_str, '--')) {
340  $this->debug_str = str_replace('--', '- -', $this->debug_str);
341  }
342  $ret = "<!--\n" . $this->debug_str . "\n-->";
343  return $ret;
344  }
$ret
Definition: parser.php:6
+ Here is the caller graph for this function:

◆ getDebugLevel()

nusoap_base::getDebugLevel ( )

gets the debug level for this instance

Returns
int Debug level 0-9, where 0 turns off public

Definition at line 266 of file nusoap.php.

References $debugLevel.

266  {
267  return $this->debugLevel;
268  }

◆ getError() [1/2]

nusoap_base::getError ( )

returns error string if present

Returns
boolean $string error string public

Definition at line 171 of file nusoap.php.

References $error_str.

Referenced by nusoap_server\__construct(), nusoap_client\_getProxyClassCode(), soap_client\call(), nusoap_client\call(), nusoap_client\checkWSDL(), nusoap_client\getOperationData(), nusoap_client\getProxy(), wsdl\parseWSDL(), soap_client\send(), nusoap_client\send(), soap_server\serialize_return(), nusoap_server\serialize_return(), soap_client\soap_client(), and soap_server\soap_server().

171  {
172  if($this->error_str != ''){
173  return $this->error_str;
174  }
175  return false;
176  }
+ Here is the caller graph for this function:

◆ getError() [2/2]

nusoap_base::getError ( )

returns error string if present

Returns
mixed error string or false public

Definition at line 369 of file nusoap.php.

References $error_str.

369  {
370  if($this->error_str != ''){
371  return $this->error_str;
372  }
373  return false;
374  }

◆ getGlobalDebugLevel()

nusoap_base::getGlobalDebugLevel ( )

gets the global debug level, which applies to future instances

Returns
integer Debug level 0-9, where 0 turns off public

Definition at line 246 of file nusoap.php.

References $GLOBALS.

246  {
247  return $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
248  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

◆ getLocalPart() [1/2]

nusoap_base::getLocalPart (   $str)

returns the local part of a prefixed string returns the original string, if not prefixed

Parameters
string
Returns
string public

Definition at line 508 of file nusoap.php.

Referenced by wsdl\addOperation(), nusoap_xmlschema\schemaEndElement(), XMLSchema\schemaStartElement(), nusoap_xmlschema\schemaStartElement(), wsdl\serialize(), wsdl\serializeComplexTypeAttributes(), wsdl\serializeComplexTypeElements(), wsdl\serializeType(), wsdl\start_element(), soap_parser\start_element(), and nusoap_parser\start_element().

508  {
509  if($sstr = strrchr($str,':')){
510  // get unqualified name
511  return substr( $sstr, 1 );
512  } else {
513  return $str;
514  }
515  }
+ Here is the caller graph for this function:

◆ getLocalPart() [2/2]

nusoap_base::getLocalPart (   $str)

returns the local part of a prefixed string returns the original string, if not prefixed

Parameters
string$strThe prefixed string
Returns
string The local part public

Definition at line 801 of file nusoap.php.

801  {
802  if($sstr = strrchr($str,':')){
803  // get unqualified name
804  return substr( $sstr, 1 );
805  } else {
806  return $str;
807  }
808  }

◆ getmicrotime()

nusoap_base::getmicrotime ( )

returns the time in ODBC canonical form with microseconds

Returns
string The time in ODBC canonical form with microseconds public

Definition at line 865 of file nusoap.php.

Referenced by debug().

865  {
866  if (function_exists('gettimeofday')) {
867  $tod = gettimeofday();
868  $sec = $tod['sec'];
869  $usec = $tod['usec'];
870  } else {
871  $sec = time();
872  $usec = 0;
873  }
874  return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
875  }
+ Here is the caller graph for this function:

◆ getNamespaceFromPrefix() [1/2]

nusoap_base::getNamespaceFromPrefix (   $prefix)

pass it a prefix, it returns a namespace returns false if no namespace registered with the given prefix

Parameters
string
Returns
mixed public

Definition at line 541 of file nusoap.php.

Referenced by wsdl\addOperation(), wsdl\parametersMatchWrapped(), XMLSchema\schemaStartElement(), nusoap_xmlschema\schemaStartElement(), wsdl\serialize(), wsdl\serializeComplexTypeAttributes(), wsdl\serializeComplexTypeElements(), and wsdl\serializeType().

541  {
542  if (isset($this->namespaces[$prefix])) {
543  return $this->namespaces[$prefix];
544  }
545  //$this->setError("No namespace registered for prefix '$prefix'");
546  return false;
547  }
+ Here is the caller graph for this function:

◆ getNamespaceFromPrefix() [2/2]

nusoap_base::getNamespaceFromPrefix (   $prefix)

pass it a prefix, it returns a namespace

Parameters
string$prefixThe prefix
Returns
mixed The namespace, false if no namespace has the specified prefix public

Definition at line 833 of file nusoap.php.

833  {
834  if (isset($this->namespaces[$prefix])) {
835  return $this->namespaces[$prefix];
836  }
837  //$this->setError("No namespace registered for prefix '$prefix'");
838  return false;
839  }

◆ getPrefix() [1/2]

nusoap_base::getPrefix (   $str)

returns the prefix part of a prefixed string returns false, if not prefixed

Parameters
string
Returns
mixed public

Definition at line 525 of file nusoap.php.

Referenced by nusoap_xmlschema\addElement(), wsdl\addOperation(), nusoap_xmlschema\schemaEndElement(), XMLSchema\schemaStartElement(), nusoap_xmlschema\schemaStartElement(), wsdl\serialize(), wsdl\serializeComplexTypeAttributes(), wsdl\serializeComplexTypeElements(), wsdl\serializeType(), soap_parser\start_element(), and nusoap_parser\start_element().

525  {
526  if($pos = strrpos($str,':')){
527  // get prefix
528  return substr($str,0,$pos);
529  }
530  return false;
531  }
+ Here is the caller graph for this function:

◆ getPrefix() [2/2]

nusoap_base::getPrefix (   $str)

returns the prefix part of a prefixed string returns false, if not prefixed

Parameters
string$strThe prefixed string
Returns
mixed The prefix or false if there is no prefix public

Definition at line 818 of file nusoap.php.

818  {
819  if($pos = strrpos($str,':')){
820  // get prefix
821  return substr($str,0,$pos);
822  }
823  return false;
824  }

◆ getPrefixFromNamespace() [1/2]

nusoap_base::getPrefixFromNamespace (   $ns)

returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace

Parameters
string
Returns
mixed public

Definition at line 557 of file nusoap.php.

References $n.

Referenced by soap_client\call(), nusoap_client\call(), contractQname(), XMLSchema\schemaStartElement(), nusoap_xmlschema\schemaStartElement(), wsdl\serialize(), XMLSchema\serializeSchema(), nusoap_xmlschema\serializeSchema(), wsdl\serializeType(), and wsdl\start_element().

557  {
558  foreach ($this->namespaces as $p => $n) {
559  if ($ns == $n || $ns == $p) {
560  $this->usedNamespaces[$p] = $n;
561  return $p;
562  }
563  }
564  return false;
565  }
$n
Definition: RandomTest.php:85
+ Here is the caller graph for this function:

◆ getPrefixFromNamespace() [2/2]

nusoap_base::getPrefixFromNamespace (   $ns)

returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace

Parameters
string$nsThe namespace
Returns
mixed The prefix, false if the namespace has no prefixes public

Definition at line 849 of file nusoap.php.

References $n.

849  {
850  foreach ($this->namespaces as $p => $n) {
851  if ($ns == $n || $ns == $p) {
852  $this->usedNamespaces[$p] = $n;
853  return $p;
854  }
855  }
856  return false;
857  }
$n
Definition: RandomTest.php:85

◆ isArraySimpleOrStruct() [1/2]

nusoap_base::isArraySimpleOrStruct (   $val)

detect if array is a simple array or a struct (associative array)

Parameters
$valThe PHP array
Returns
string (arraySimple|arrayStruct) private

Definition at line 195 of file nusoap.php.

Referenced by wsdl\parametersMatchWrapped(), serialize_val(), wsdl\serializeComplexTypeElements(), wsdl\serializeParameters(), wsdl\serializeRPCParameters(), and wsdl\serializeType().

195  {
196  $keyList = array_keys($val);
197  foreach ($keyList as $keyListValue) {
198  if (!is_int($keyListValue)) {
199  return 'arrayStruct';
200  }
201  }
202  return 'arraySimple';
203  }
+ Here is the caller graph for this function:

◆ isArraySimpleOrStruct() [2/2]

nusoap_base::isArraySimpleOrStruct (   $val)

detect if array is a simple array or a struct (associative array)

Parameters
mixed$valThe PHP array
Returns
string (arraySimple|arrayStruct) private

Definition at line 393 of file nusoap.php.

393  {
394  $keyList = array_keys($val);
395  foreach ($keyList as $keyListValue) {
396  if (!is_int($keyListValue)) {
397  return 'arrayStruct';
398  }
399  }
400  return 'arraySimple';
401  }

◆ serialize_val() [1/2]

nusoap_base::serialize_val (   $val,
  $name = false,
  $type = false,
  $name_ns = false,
  $type_ns = false,
  $attributes = false,
  $use = 'encoded' 
)

serializes PHP values in accordance w/ section 5.

Type information is not serialized if $use == 'literal'.

Returns
string public

Definition at line 212 of file nusoap.php.

References $attributes, $i, $name, $type, $xml, debug(), expandEntities(), and isArraySimpleOrStruct().

Referenced by soap_client\call(), nusoap_client\call(), nusoap_fault\serialize(), soapval\serialize(), soap_server\serialize_return(), nusoap_server\serialize_return(), serialize_val(), wsdl\serializeComplexTypeElements(), serializeEnvelope(), and wsdl\serializeType().

212  {
213  if(is_object($val) && get_class($val) == 'soapval'){
214  return $val->serialize($use);
215  }
216  $this->debug( "in serialize_val: $val, $name, $type, $name_ns, $type_ns, $attributes, $use");
217  // if no name, use item
218  $name = (!$name|| is_numeric($name)) ? 'soapVal' : $name;
219  // if name has ns, add ns prefix to name
220  $xmlns = '';
221  if($name_ns){
222  $prefix = 'nu'.rand(1000,9999);
223  $name = $prefix.':'.$name;
224  $xmlns .= " xmlns:$prefix=\"$name_ns\"";
225  }
226  // if type is prefixed, create type prefix
227  if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
228  // need to fix this. shouldn't default to xsd if no ns specified
229  // w/o checking against typemap
230  $type_prefix = 'xsd';
231  } elseif($type_ns){
232  $type_prefix = 'ns'.rand(1000,9999);
233  $xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
234  }
235  // serialize attributes if present
236  $atts = '';
237  if($attributes){
238  foreach($attributes as $k => $v){
239  $atts .= " $k=\"$v\"";
240  }
241  }
242  // serialize if an xsd built-in primitive type
243  if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
244  if (is_bool($val)) {
245  if ($type == 'boolean') {
246  $val = $val ? 'true' : 'false';
247  } elseif (! $val) {
248  $val = 0;
249  }
250  } else if (is_string($val)) {
251  $val = $this->expandEntities($val);
252  }
253  if ($use == 'literal') {
254  return "<$name$xmlns>$val</$name>";
255  } else {
256  return "<$name$xmlns xsi:type=\"xsd:$type\">$val</$name>";
257  }
258  }
259  // detect type and serialize
260  $xml = '';
261  switch(true) {
262  case ($type == '' && is_null($val)):
263  if ($use == 'literal') {
264  // TODO: depends on nillable
265  $xml .= "<$name$xmlns/>";
266  } else {
267  $xml .= "<$name$xmlns xsi:nil=\"true\"/>";
268  }
269  break;
270  case (is_bool($val) || $type == 'boolean'):
271  if ($type == 'boolean') {
272  $val = $val ? 'true' : 'false';
273  } elseif (! $val) {
274  $val = 0;
275  }
276  if ($use == 'literal') {
277  $xml .= "<$name$xmlns $atts>$val</$name>";
278  } else {
279  $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
280  }
281  break;
282  case (is_int($val) || is_long($val) || $type == 'int'):
283  if ($use == 'literal') {
284  $xml .= "<$name$xmlns $atts>$val</$name>";
285  } else {
286  $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
287  }
288  break;
289  case (is_float($val)|| is_double($val) || $type == 'float'):
290  if ($use == 'literal') {
291  $xml .= "<$name$xmlns $atts>$val</$name>";
292  } else {
293  $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
294  }
295  break;
296  case (is_string($val) || $type == 'string'):
297  $val = $this->expandEntities($val);
298  if ($use == 'literal') {
299  $xml .= "<$name$xmlns $atts>$val</$name>";
300  } else {
301  $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
302  }
303  break;
304  case is_object($val):
305  $name = get_class($val);
306  foreach(get_object_vars($val) as $k => $v){
307  $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
308  }
309  $xml .= '<'.$name.'>'.$pXml.'</'.$name.'>';
310  break;
311  break;
312  case (is_array($val) || $type):
313  // detect if struct or array
314  $valueType = $this->isArraySimpleOrStruct($val);
315  if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
316  $i = 0;
317  if(is_array($val) && count($val)> 0){
318  foreach($val as $v){
319  if(is_object($v) && get_class($v) == 'soapval'){
320  $tt_ns = $v->type_ns;
321  $tt = $v->type;
322  } elseif (is_array($v)) {
323  $tt = $this->isArraySimpleOrStruct($v);
324  } else {
325  $tt = gettype($v);
326  }
327  $array_types[$tt] = 1;
328  $xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
329  ++$i;
330  }
331  if(count($array_types) > 1){
332  $array_typename = 'xsd:ur-type';
333  } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
334  if ($tt == 'integer') {
335  $tt = 'int';
336  }
337  $array_typename = 'xsd:'.$tt;
338  } elseif(isset($tt) && $tt == 'arraySimple'){
339  $array_typename = 'SOAP-ENC:Array';
340  } elseif(isset($tt) && $tt == 'arrayStruct'){
341  $array_typename = 'unnamed_struct_use_soapval';
342  } else {
343  // if type is prefixed, create type prefix
344  if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
345  $array_typename = 'xsd:' . $tt;
346  } elseif ($tt_ns) {
347  $tt_prefix = 'ns' . rand(1000, 9999);
348  $array_typename = "$tt_prefix:$tt";
349  $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
350  } else {
351  $array_typename = $tt;
352  }
353  }
354  $array_type = $i;
355  if ($use == 'literal') {
356  $type_str = '';
357  } else if (isset($type) && isset($type_prefix)) {
358  $type_str = " xsi:type=\"$type_prefix:$type\"";
359  } else {
360  $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
361  }
362  // empty array
363  } else {
364  if ($use == 'literal') {
365  $type_str = '';
366  } else if (isset($type) && isset($type_prefix)) {
367  $type_str = " xsi:type=\"$type_prefix:$type\"";
368  } else {
369  $type_str = " xsi:type=\"SOAP-ENC:Array\"";
370  }
371  }
372  $xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
373  } else {
374  // got a struct
375  if(isset($type) && isset($type_prefix)){
376  $type_str = " xsi:type=\"$type_prefix:$type\"";
377  } else {
378  $type_str = '';
379  }
380  if ($use == 'literal') {
381  $xml .= "<$name$xmlns $atts>";
382  } else {
383  $xml .= "<$name$xmlns$type_str$atts>";
384  }
385  foreach($val as $k => $v){
386  // Apache Map
387  if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
388  $xml .= '<item>';
389  $xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
390  $xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
391  $xml .= '</item>';
392  } else {
393  $xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
394  }
395  }
396  $xml .= "</$name>";
397  }
398  break;
399  default:
400  $xml .= 'not detected, got '.gettype($val).' for '.$val;
401  break;
402  }
403  return $xml;
404  }
$attributes
Definition: metadata.php:231
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:195
$type
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
if($format !==null) $name
Definition: metadata.php:230
$xml
Definition: metadata.php:332
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
serializes PHP values in accordance w/ section 5.
Definition: nusoap.php:212
expandEntities($val)
expands entities, e.g.
Definition: nusoap.php:154
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize_val() [2/2]

nusoap_base::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.

Type information is not serialized if $use == 'literal'.

Parameters
mixed$valThe value to serialize
string$nameThe name (local part) of the XML element
string$typeThe XML schema type (local part) for the element
string$name_nsThe namespace for the name of the XML element
string$type_nsThe namespace for the type of the element
array$attributesThe attributes to serialize as name=>value pairs
string$useThe WSDL "use" (encoded|literal)
boolean$soapvalWhether this is called from soapval.
Returns
string The serialized element, possibly with child elements public

Definition at line 418 of file nusoap.php.

References $attributes, $i, $name, $type, $xml, appendDebug(), debug(), expandEntities(), isArraySimpleOrStruct(), serialize_val(), and varDump().

418  {
419  $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
420  $this->appendDebug('value=' . $this->varDump($val));
421  $this->appendDebug('attributes=' . $this->varDump($attributes));
422 
423  if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
424  $this->debug("serialize_val: serialize soapval");
425  $xml = $val->serialize($use);
426  $this->appendDebug($val->getDebug());
427  $val->clearDebug();
428  $this->debug("serialize_val of soapval returning $xml");
429  return $xml;
430  }
431  // force valid name if necessary
432  if (is_numeric($name)) {
433  $name = '__numeric_' . $name;
434  } elseif (! $name) {
435  $name = 'noname';
436  }
437  // if name has ns, add ns prefix to name
438  $xmlns = '';
439  if($name_ns){
440  $prefix = 'nu'.rand(1000,9999);
441  $name = $prefix.':'.$name;
442  $xmlns .= " xmlns:$prefix=\"$name_ns\"";
443  }
444  // if type is prefixed, create type prefix
445  if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
446  // need to fix this. shouldn't default to xsd if no ns specified
447  // w/o checking against typemap
448  $type_prefix = 'xsd';
449  } elseif($type_ns){
450  $type_prefix = 'ns'.rand(1000,9999);
451  $xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
452  }
453  // serialize attributes if present
454  $atts = '';
455  if($attributes){
456  foreach($attributes as $k => $v){
457  $atts .= " $k=\"".$this->expandEntities($v).'"';
458  }
459  }
460  // serialize null value
461  if (is_null($val)) {
462  $this->debug("serialize_val: serialize null");
463  if ($use == 'literal') {
464  // TODO: depends on minOccurs
465  $xml = "<$name$xmlns$atts/>";
466  $this->debug("serialize_val returning $xml");
467  return $xml;
468  } else {
469  if (isset($type) && isset($type_prefix)) {
470  $type_str = " xsi:type=\"$type_prefix:$type\"";
471  } else {
472  $type_str = '';
473  }
474  $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>";
475  $this->debug("serialize_val returning $xml");
476  return $xml;
477  }
478  }
479  // serialize if an xsd built-in primitive type
480  if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
481  $this->debug("serialize_val: serialize xsd built-in primitive type");
482  if (is_bool($val)) {
483  if ($type == 'boolean') {
484  $val = $val ? 'true' : 'false';
485  } elseif (! $val) {
486  $val = 0;
487  }
488  } else if (is_string($val)) {
489  $val = $this->expandEntities($val);
490  }
491  if ($use == 'literal') {
492  $xml = "<$name$xmlns$atts>$val</$name>";
493  $this->debug("serialize_val returning $xml");
494  return $xml;
495  } else {
496  $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val</$name>";
497  $this->debug("serialize_val returning $xml");
498  return $xml;
499  }
500  }
501  // detect type and serialize
502  $xml = '';
503  switch(true) {
504  case (is_bool($val) || $type == 'boolean'):
505  $this->debug("serialize_val: serialize boolean");
506  if ($type == 'boolean') {
507  $val = $val ? 'true' : 'false';
508  } elseif (! $val) {
509  $val = 0;
510  }
511  if ($use == 'literal') {
512  $xml .= "<$name$xmlns$atts>$val</$name>";
513  } else {
514  $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
515  }
516  break;
517  case (is_int($val) || is_long($val) || $type == 'int'):
518  $this->debug("serialize_val: serialize int");
519  if ($use == 'literal') {
520  $xml .= "<$name$xmlns$atts>$val</$name>";
521  } else {
522  $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
523  }
524  break;
525  case (is_float($val)|| is_double($val) || $type == 'float'):
526  $this->debug("serialize_val: serialize float");
527  if ($use == 'literal') {
528  $xml .= "<$name$xmlns$atts>$val</$name>";
529  } else {
530  $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
531  }
532  break;
533  case (is_string($val) || $type == 'string'):
534  $this->debug("serialize_val: serialize string");
535  $val = $this->expandEntities($val);
536  if ($use == 'literal') {
537  $xml .= "<$name$xmlns$atts>$val</$name>";
538  } else {
539  $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
540  }
541  break;
542  case is_object($val):
543  $this->debug("serialize_val: serialize object");
544  if (get_class($val) == 'soapval') {
545  $this->debug("serialize_val: serialize soapval object");
546  $pXml = $val->serialize($use);
547  $this->appendDebug($val->getDebug());
548  $val->clearDebug();
549  } else {
550  if (! $name) {
551  $name = get_class($val);
552  $this->debug("In serialize_val, used class name $name as element name");
553  } else {
554  $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
555  }
556  foreach(get_object_vars($val) as $k => $v){
557  $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
558  }
559  }
560  if(isset($type) && isset($type_prefix)){
561  $type_str = " xsi:type=\"$type_prefix:$type\"";
562  } else {
563  $type_str = '';
564  }
565  if ($use == 'literal') {
566  $xml .= "<$name$xmlns$atts>$pXml</$name>";
567  } else {
568  $xml .= "<$name$xmlns$type_str$atts>$pXml</$name>";
569  }
570  break;
571  break;
572  case (is_array($val) || $type):
573  // detect if struct or array
574  $valueType = $this->isArraySimpleOrStruct($val);
575  if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
576  $this->debug("serialize_val: serialize array");
577  $i = 0;
578  if(is_array($val) && count($val)> 0){
579  foreach($val as $v){
580  if(is_object($v) && get_class($v) == 'soapval'){
581  $tt_ns = $v->type_ns;
582  $tt = $v->type;
583  } elseif (is_array($v)) {
584  $tt = $this->isArraySimpleOrStruct($v);
585  } else {
586  $tt = gettype($v);
587  }
588  $array_types[$tt] = 1;
589  // TODO: for literal, the name should be $name
590  $xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
591  ++$i;
592  }
593  if(count($array_types) > 1){
594  $array_typename = 'xsd:anyType';
595  } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
596  if ($tt == 'integer') {
597  $tt = 'int';
598  }
599  $array_typename = 'xsd:'.$tt;
600  } elseif(isset($tt) && $tt == 'arraySimple'){
601  $array_typename = 'SOAP-ENC:Array';
602  } elseif(isset($tt) && $tt == 'arrayStruct'){
603  $array_typename = 'unnamed_struct_use_soapval';
604  } else {
605  // if type is prefixed, create type prefix
606  if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
607  $array_typename = 'xsd:' . $tt;
608  } elseif ($tt_ns) {
609  $tt_prefix = 'ns' . rand(1000, 9999);
610  $array_typename = "$tt_prefix:$tt";
611  $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
612  } else {
613  $array_typename = $tt;
614  }
615  }
616  $array_type = $i;
617  if ($use == 'literal') {
618  $type_str = '';
619  } else if (isset($type) && isset($type_prefix)) {
620  $type_str = " xsi:type=\"$type_prefix:$type\"";
621  } else {
622  $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
623  }
624  // empty array
625  } else {
626  if ($use == 'literal') {
627  $type_str = '';
628  } else if (isset($type) && isset($type_prefix)) {
629  $type_str = " xsi:type=\"$type_prefix:$type\"";
630  } else {
631  $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
632  }
633  }
634  // TODO: for array in literal, there is no wrapper here
635  $xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
636  } else {
637  // got a struct
638  $this->debug("serialize_val: serialize struct");
639  if(isset($type) && isset($type_prefix)){
640  $type_str = " xsi:type=\"$type_prefix:$type\"";
641  } else {
642  $type_str = '';
643  }
644  if ($use == 'literal') {
645  $xml .= "<$name$xmlns$atts>";
646  } else {
647  $xml .= "<$name$xmlns$type_str$atts>";
648  }
649  foreach($val as $k => $v){
650  // Apache Map
651  if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
652  $xml .= '<item>';
653  $xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
654  $xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
655  $xml .= '</item>';
656  } else {
657  $xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
658  }
659  }
660  $xml .= "</$name>";
661  }
662  break;
663  default:
664  $this->debug("serialize_val: serialize unknown");
665  $xml .= 'not detected, got '.gettype($val).' for '.$val;
666  break;
667  }
668  $this->debug("serialize_val returning $xml");
669  return $xml;
670  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:298
$attributes
Definition: metadata.php:231
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:195
$type
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
if($format !==null) $name
Definition: metadata.php:230
$xml
Definition: metadata.php:332
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
serializes PHP values in accordance w/ section 5.
Definition: nusoap.php:212
varDump($data)
Definition: nusoap.php:567
expandEntities($val)
expands entities, e.g.
Definition: nusoap.php:154
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ serializeEnvelope() [1/2]

nusoap_base::serializeEnvelope (   $body,
  $headers = false,
  $namespaces = array(),
  $style = 'rpc',
  $use = 'encoded' 
)

serialize message

Parameters
stringbody
stringheaders optional
arraynamespaces optional
stringstyle optional (rpc|document)
stringuse optional (encoded|literal)
Returns
string message public

Definition at line 417 of file nusoap.php.

Referenced by soap_client\call(), nusoap_client\call(), soap_server\serialize_return(), and nusoap_server\serialize_return().

417  {
418  // TODO: add an option to automatically run utf8_encode on $body and $headers
419  // if $this->soap_defencoding is UTF-8. Not doing this automatically allows
420  // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
421 
422  // serialize namespaces
423  $ns_string = '';
424  foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
425  $ns_string .= " xmlns:$k=\"$v\"";
426  }
427  if($style == 'rpc' && $use == 'encoded') {
428  $ns_string = ' SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' . $ns_string;
429  }
430 
431  // serialize headers
432  if($headers){
433  $headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
434  }
435  // serialize envelope
436  return
437  '<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
438  '<SOAP-ENV:Envelope'.$ns_string.">".
439  $headers.
440  "<SOAP-ENV:Body>".
441  $body.
442  "</SOAP-ENV:Body>".
443  "</SOAP-ENV:Envelope>";
444  }
+ Here is the caller graph for this function:

◆ serializeEnvelope() [2/2]

nusoap_base::serializeEnvelope (   $body,
  $headers = false,
  $namespaces = array(),
  $style = 'rpc',
  $use = 'encoded',
  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/' 
)

serializes a message

Parameters
string$bodythe XML of the SOAP body
mixed$headersoptional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array
array$namespacesoptional the namespaces used in generating the body and headers
string$styleoptional (rpc|document)
string$useoptional (encoded|literal)
string$encodingStyleoptional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
Returns
string the message public

Definition at line 684 of file nusoap.php.

References $xml, appendDebug(), debug(), serialize_val(), and varDump().

684  ://schemas.xmlsoap.org/soap/encoding/'){
685  // TODO: add an option to automatically run utf8_encode on $body and $headers
686  // if $this->soap_defencoding is UTF-8. Not doing this automatically allows
687  // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
688 
689  $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
690  $this->debug("headers:");
691  $this->appendDebug($this->varDump($headers));
692  $this->debug("namespaces:");
693  $this->appendDebug($this->varDump($namespaces));
694 
695  // serialize namespaces
696  $ns_string = '';
697  foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
698  $ns_string .= " xmlns:$k=\"$v\"";
699  }
700  if($encodingStyle) {
701  $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
702  }
703 
704  // serialize headers
705  if($headers){
706  if (is_array($headers)) {
707  $xml = '';
708  foreach ($headers as $k => $v) {
709  if (is_object($v) && get_class($v) == 'soapval') {
710  $xml .= $this->serialize_val($v, false, false, false, false, false, $use);
711  } else {
712  $xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
713  }
714  }
715  $headers = $xml;
716  $this->debug("In serializeEnvelope, serialized array of headers to $headers");
717  }
718  $headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
719  }
720  // serialize envelope
721  return
722  '<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
723  '<SOAP-ENV:Envelope'.$ns_string.">".
724  $headers.
725  "<SOAP-ENV:Body>".
726  $body.
727  "</SOAP-ENV:Body>".
728  "</SOAP-ENV:Envelope>";
729  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:298
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$xml
Definition: metadata.php:332
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
serializes PHP values in accordance w/ section 5.
Definition: nusoap.php:212
varDump($data)
Definition: nusoap.php:567
+ Here is the call graph for this function:

◆ setDebugLevel()

nusoap_base::setDebugLevel (   $level)

sets the debug level for this instance

Parameters
int$levelDebug level 0-9, where 0 turns off public

Definition at line 276 of file nusoap.php.

276  {
277  $this->debugLevel = $level;
278  }

◆ setError() [1/2]

◆ setError() [2/2]

nusoap_base::setError (   $str)

sets error string

Returns
boolean $string error string private

Definition at line 382 of file nusoap.php.

382  {
383  $this->error_str = $str;
384  }

◆ setGlobalDebugLevel()

nusoap_base::setGlobalDebugLevel (   $level)

sets the global debug level, which applies to future instances

Parameters
int$levelDebug level 0-9, where 0 turns off public

Definition at line 256 of file nusoap.php.

References $GLOBALS.

256  {
257  $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = $level;
258  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

◆ varDump() [1/2]

◆ varDump() [2/2]

nusoap_base::varDump (   $data)

Returns a string with the output of var_dump.

Parameters
mixed$dataThe variable to var_dump
Returns
string The output of var_dump public

Definition at line 884 of file nusoap.php.

References $data.

884  {
885  ob_start();
886  var_dump($data);
887  $ret_val = ob_get_contents();
888  ob_end_clean();
889  return $ret_val;
890  }
$data
Definition: storeScorm.php:23

Field Documentation

◆ $charencoding

nusoap_base::$charencoding = true

Definition at line 70 of file nusoap.php.

◆ $debug_str

nusoap_base::$debug_str = ''

Definition at line 67 of file nusoap.php.

Referenced by getDebug().

◆ $debugLevel

nusoap_base::$debugLevel

Definition at line 146 of file nusoap.php.

Referenced by getDebugLevel().

◆ $error_str

nusoap_base::$error_str = false

Definition at line 66 of file nusoap.php.

Referenced by soap_transport_http\connect(), and getError().

◆ $namespaces

nusoap_base::$namespaces
Initial value:
= array(
'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
'xsd' => 'http://www.w3.org/2001/XMLSchema',
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/',
'si' => 'http://soapinterop.org/xsd')

Definition at line 95 of file nusoap.php.

Referenced by nusoap_xmlschema\__construct(), and XMLSchema\XMLSchema().

◆ $revision

nusoap_base::$revision = '$Revision$'

Definition at line 65 of file nusoap.php.

◆ $soap_defencoding

◆ $title

nusoap_base::$title = 'NuSOAP'

Definition at line 63 of file nusoap.php.

◆ $typemap

nusoap_base::$typemap
Initial value:
= array(
'http://www.w3.org/2001/XMLSchema' => array(
'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),
'http://www.w3.org/1999/XMLSchema' => array(
'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
'float'=>'double','dateTime'=>'string',
'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
'http://xml.apache.org/xml-soap' => array('Map')
)

Definition at line 110 of file nusoap.php.

◆ $usedNamespaces

nusoap_base::$usedNamespaces = array()

Definition at line 101 of file nusoap.php.

◆ $version

nusoap_base::$version = '0.6.7'

Definition at line 64 of file nusoap.php.

◆ $xmlEntities

nusoap_base::$xmlEntities
Initial value:
= array('quot' => '"','amp' => '&',
'lt' => '<','gt' => '>','apos' => "'")

Definition at line 135 of file nusoap.php.

◆ $XMLSchemaVersion

nusoap_base::$XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'

Definition at line 78 of file nusoap.php.

Referenced by soap_parser\start_element(), and nusoap_parser\start_element().


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